The trichotomy of HAVING queries on a probabilistic database

  • Authors:
  • Christopher Ré;Dan Suciu

  • Affiliations:
  • Department of Computer Science and Engineering, University of Washington, Seattle, USA;Department of Computer Science and Engineering, University of Washington, Seattle, USA

  • Venue:
  • The VLDB Journal — The International Journal on Very Large Data Bases
  • Year:
  • 2009

Quantified Score

Hi-index 0.00

Visualization

Abstract

We study the evaluation of positive conjunctive queries with Boolean aggregate tests (similar to HAVING in SQL) on probabilistic databases. More precisely, we study conjunctive queries with predicate aggregates on probabilistic databases where the aggregation function is one of MIN, MAX, EXISTS, COUNT, SUM, AVG, or COUNT(DISTINCT) and the comparison function is one of =, 驴,驴,,驴, or 驴, and the comparison function, 驴. In this paper, we establish a set of trichotomy results for conjunctive queries with HAVING predicates parametrized by (驴, 驴). For such queries (without self-joins), one of the following three statements is true: (1) the exact evaluation problem has $${\mathcal P}$$ -time data complexity. In this case, we call the query safe. (2) The exact evaluation problem is $${{\sharp{\mathcal P}}}$$ -hard, but the approximate evaluation problem has (randomized) $${{\mathcal P}}$$ -time data complexity. More precisely, there exists an FPTRAS for the query. In this case, we call the query apx-safe. (3) The exact evaluation problem is $${{\sharp{\mathcal P}}}$$ -hard, and the approximate evaluation problem is also hard. We call these queries hazardous. The precise definition of each class depends on the aggregate considered and the comparison function. Thus, we have queries that are (MAX,驴 )-safe, (COUNT,驴 )-apx-safe, (SUM,=)-hazardous, etc. Our trichotomy result is a significant extension of a previous dichotomy result for Boolean conjunctive queries into safe and not safe. For each of the three classes we present novel techniques. For safe queries, we describe an evaluation algorithm that uses random variables over semirings. For apx-safe queries, we describe an FPTRAS that relies on a novel algorithm for generating a random possible world satisfying a given condition. Finally, for hazardous queries we give novel proofs of hardness of approximation. The results for safe queries were previously announced (in Ré, C., Suciu, D. Efficient evaluation of. In: DBPL, pp. 186---200, 2007), but all other results are new.