Probabilistic Query Evaluation with Bag Semantics

Martin Grohe, Peter Lindner, Christoph Standke

Introduction

Traditional database theory often operates under set semantics, where query results are sets of unique tuples. However, real-world SQL engines typically employ bag semantics, allowing for duplicate rows. This distinction is particularly significant in Probabilistic Databases (PDBs), which manage uncertain data. While the complexity of query evaluation under set semantics is well-defined by the "Dalvi-Suciu Dichotomy," the landscape for bag semantics has remained largely unexplored. This paper addresses this gap by investigating the complexity of querying PDBs where tuple multiplicities follow discrete probability distributions.

Problem Definition

In a set-based PDB, the answer to a Boolean query is a single probability representing the likelihood that the query is satisfied. In contrast, under bag semantics, the answer is a probability distribution over non-negative integers, representing the possible counts of query results. The paper focuses on two primary computational problems:

  1. EXPECTATION: Computing the expected number of times a query is satisfied.
  2. Probabilistic Query Evaluation (PQE): Computing the probability that a query is satisfied at most $k$ times.

Methodology: Parameterized TI Representation Systems

To formalize these problems, the authors introduce Parameterized TI Representation Systems (TIRS). In this framework, a database is a collection of independent facts, where each fact's multiplicity is a random variable following a specific distribution.

Example of a Parameterized TI Representation System showing relations R and S with various probability distributions for tuple multiplicities.

As shown in Figure 1, TIRS can accommodate a variety of distributions, including Bernoulli, Binomial, Geometric, and Poisson, as well as arbitrary finite distributions. This flexibility allows for a more realistic modeling of uncertainty in bag-based databases.

To analyze complexity, the authors utilize several key mathematical techniques:

  • Linearity of Expectation: Under bag semantics, existential quantifiers and disjunctions behave as sums, simplifying expectation calculations.
  • Query "Inflations": A novel reduction technique where multiple independent copies of facts are created to prove hardness for the PQE problem.
  • Polynomial Interpolation: By querying the probability of "at most $k$" results on inflated databases, the authors use finite differences to calculate the probability of exactly zero results, linking bag semantics complexity back to known set semantics hardness.

Key Findings and Complexity Results

The paper establishes a clear complexity landscape for bag semantics, revealing a sharp contrast between expectation and probability evaluation.

Expectations are Tractable

A major finding is that computing the expected number of results (and higher moments like variance) for any Union of Conjunctive Queries (UCQ) is solvable in polynomial time, provided the underlying distributions have polynomially computable moments. This is a significant departure from set semantics, where the same problem is often #P-hard. The additive nature of bag semantics transforms a complex logical problem into a manageable arithmetic one.

The PQE Dichotomy

For the probability of specific counts (PQE), the authors prove a new dichotomy for self-join free conjunctive queries. The complexity depends on the structural property of the query:

  1. Hierarchical Queries: If a query $Q$ is hierarchical, PQE(Q, k) can be computed in Polynomial Time.
  2. Non-Hierarchical Queries: If $Q$ is non-hierarchical, PQE(Q, k) is #P-hard for all $k \geq 0$.

This result demonstrates that the "hierarchical" boundary, which defines tractability in set semantics, remains the fundamental limit for efficient probabilistic reasoning under bag semantics.

Conclusion and Future Work

This research provides a comprehensive map of the complexity of probabilistic query evaluation under bag semantics. While calculating expectations is surprisingly efficient, determining exact probability distributions remains computationally difficult for non-hierarchical queries.

Future research directions include extending the dichotomy to queries with self-joins, handling irrational probabilities arising from distributions like Poisson, and exploring more complex aggregation functions such as SUM or AVG over attributes.

Summary updated

BibTeX
@inproceedings{grohe2023probabilistic,
  author = {Martin Grohe and Peter Lindner and Christoph Standke},
  title = {{Probabilistic Query Evaluation with Bag Semantics}},
  booktitle = {ICDT},
  year = {2023},
  doi = {10.4230/lipics.icdt.2023.20},
}
Figure