Algorithm Search⌘K

Modeladvanced

Probabilistic database

Also called tuple-independent probabilistic database.

A database whose tuples are present with given probabilities; a query returns each answer with the probability that it holds.

A probabilistic database is a database in which each tuple is present only with some probability, so that the database stands for a probability distribution over ordinary instances, its possible worlds. A query returns each answer together with its marginal probability, the total probability of the worlds in which the answer holds. The common models are tuple-independent databases, where the tuples are independent events, and block-independent-disjoint databases, where the tuples of a block exclude each other. Computing the probability of a query answer is a weighted counting problem, #P-hard in general, and for some queries it can be done in polynomial time by rules that use independence.

The machine

The setting is the relational model under set semantics, with a fixed schema; the notation is that of relational algebra.

Possible worlds. A probabilistic database is a pair (W,P)(\mathcal{W}, P) of a finite set W\mathcal{W} of instances, the possible worlds, and a probability distribution PP on W\mathcal{W}, so P(W)≥0P(W) \geq 0 and ∑W∈WP(W)=1\sum_{W \in \mathcal{W}} P(W) = 1. Listing the worlds is not practical, so the models below describe PP by a table.

Tuple-independent databases (TID). Each relation is a set of tuples, and each tuple tt carries a probability p(t)p(t) with 0<p(t)≤10 < p(t) \leq 1. Let TT be the set of all these tuples. The possible worlds are all subsets W⊆TW \subseteq T, with

P(W)=∏t∈Wp(t)⋅∏t∈T∖W(1−p(t)).P(W) = \prod_{t \in W} p(t) \cdot \prod_{t \in T \setminus W} \big(1 - p(t)\big).

So each tuple is present with probability p(t)p(t), independently of the others. A database with nn tuples has 2n2^{n} worlds, all described by nn numbers. A tuple with p(t)=1p(t) = 1 is certain, and a relation all of whose tuples are certain is deterministic.

Block-independent-disjoint databases (BID). The tuples of a relation are split into blocks, usually the tuples with the same key. In a world, at most one tuple of each block is present: tuple tt of block bb with probability p(t)p(t), and no tuple of bb with probability 1−∑t∈bp(t)1 - \sum_{t \in b} p(t), so the probabilities in a block sum to at most 1. Different blocks are independent. A TID is the BID in which every block has one tuple. BIDs express attributes with an uncertain value, such as a city that is Paris with probability 0.60.6 or Rome with probability 0.30.3.

Queries. A query QQ of the relational calculus or algebra is evaluated in each world. For a Boolean query,

P(Q)=∑{ P(W)∣W∈W, W⊨Q }.P(Q) = \sum \{\, P(W) \mid W \in \mathcal{W},\ W \models Q \,\}.

For a query with free variables, each candidate answer aa gets the probability P(Q[a])P(Q[a]) of the Boolean query Q[a]Q[a] obtained by substituting aa. The output is the set of pairs (a,P(Q[a]))(a, P(Q[a])) with P(Q[a])>0P(Q[a]) > 0. The query itself is an ordinary query; only the evaluation changes.

Lineage. For a union of conjunctive queries QQ on a TID, introduce a Boolean variable XtX_t for each tuple tt, meaning "tt is present". The lineage ΦQ\Phi_Q is the DNF formula with one conjunction Xt1∧⋯∧XtkX_{t_1} \land \cdots \land X_{t_k} for each set {t1,…,tk}\{t_1, \ldots, t_k\} of tuples that together make QQ true, that is, the disjunction over the witnesses of QQ (see why-provenance). A world satisfies QQ exactly when its tuples satisfy ΦQ\Phi_Q, so P(Q)=P(ΦQ)P(Q) = P(\Phi_Q) when each XtX_t is true independently with probability p(t)p(t). The lineage is the provenance of QQ in the semiring of positive Boolean formulas (see provenance semirings), and for a fixed QQ it has polynomial size in the database.

What it counts

The model assigns to each answer a probability, the weight of the set of worlds in which it holds. For a TID and a union of conjunctive queries this is the probability of a monotone DNF formula under independent variables, which is a weighted model count: the sum, over the satisfying assignments of ΦQ\Phi_Q, of the product of p(t)p(t) for true variables and 1−p(t)1 - p(t) for false ones (see model counting). With all p(t)=1/2p(t) = 1/2, P(Q)⋅2nP(Q) \cdot 2^{n} is the number of satisfying assignments.

Example. A TID with R(x)R(x) and S(x,y)S(x, y):

tuple pp
r1=R(a)r_1 = R(a) 0.5
r2=R(b)r_2 = R(b) 0.4
s1=S(a,c)s_1 = S(a, c) 0.6
s2=S(a,d)s_2 = S(a, d) 0.5
s3=S(b,c)s_3 = S(b, c) 0.2

The Boolean query Q=∃x ∃y (R(x)∧S(x,y))Q = \exists x\, \exists y\, (R(x) \land S(x, y)) has the lineage ΦQ=r1s1∨r1s2∨r2s3\Phi_Q = r_1 s_1 \lor r_1 s_2 \lor r_2 s_3. The two values of xx use disjoint tuples, so they are independent:

  • for x=ax = a: P(R(a)∧∃y S(a,y))=0.5⋅(1−(1−0.6)(1−0.5))=0.5⋅0.8=0.4P(R(a) \land \exists y\, S(a, y)) = 0.5 \cdot \big(1 - (1 - 0.6)(1 - 0.5)\big) = 0.5 \cdot 0.8 = 0.4;
  • for x=bx = b: 0.4⋅0.2=0.080.4 \cdot 0.2 = 0.08;
  • so P(Q)=1−(1−0.4)(1−0.08)=1−0.6⋅0.92=0.448P(Q) = 1 - (1 - 0.4)(1 - 0.08) = 1 - 0.6 \cdot 0.92 = 0.448.

Summing P(W)P(W) over the 25=322^{5} = 32 worlds that satisfy ΦQ\Phi_Q gives the same 0.448.

A wrong plan. Compute the join first, R(a)S(a,c)R(a) S(a, c) with probability 0.5⋅0.6=0.30.5 \cdot 0.6 = 0.3, R(a)S(a,d)R(a) S(a, d) with 0.250.25 and R(b)S(b,c)R(b) S(b, c) with 0.080.08, and then treat the three join tuples as independent in the projection: 1−0.7⋅0.75⋅0.92=0.5171 - 0.7 \cdot 0.75 \cdot 0.92 = 0.517. This is wrong, because the first two join tuples share r1r_1 and are not independent. The plan that projects yy away inside SS before the join, as above, gives the right answer. Plans whose every step respects independence are the safe plans of Dalvi and Suciu (2004).

Relation to other models

  • Incomplete databases. An incomplete database is a set of possible worlds without probabilities; its certain answers are the answers true in every world. A probabilistic database adds a distribution, and an answer has probability 1 exactly when it is true in every world with positive probability.
  • Provenance semirings. Query evaluation by lineage is evaluation in the semiring of positive Boolean formulas, followed by a probability computation that is not a semiring homomorphism: P(φ∧ψ)=P(φ)P(ψ)P(\varphi \land \psi) = P(\varphi) P(\psi) only when φ\varphi and ψ\psi share no variable. See provenance semirings.
  • Knowledge compilation. Intensional evaluation compiles ΦQ\Phi_Q into a form with linear-time probability computation, such as a d-DNNF or an ordered binary decision diagram, by Shannon expansion and decomposition into independent parts. The cost is the size of the compiled form.
  • Graphical models. A TID is the simplest probabilistic model, with all variables independent. Correlations are added by richer representations, for example by conditions on tuples or by factors over tuples as in a factor graph; query evaluation then becomes inference in that model.

Known results in the model

All results are in data complexity: the query is fixed and the input is the database with its probabilities (see data and combined complexity).

  • Hardness in general. Computing P(Q)P(Q) is in FP#P\mathrm{FP}^{\#\mathrm{P}} for every fixed query of the relational calculus, by summing over the worlds with a #P oracle. It is #P-hard for some fixed conjunctive queries, already for H0=∃x ∃y (R(x)∧S(x,y)∧T(y))H_0 = \exists x\, \exists y\, (R(x) \land S(x, y) \land T(y)) on a TID (Dalvi and Suciu 2004).
  • Dichotomy. For unions of conjunctive queries on TIDs, each query is either computable in polynomial time by the lifted inference rules (independent join, independent union, independent project, inclusion-exclusion) or #P-hard. For conjunctive queries without self-joins, the polynomial ones are exactly the hierarchical ones. This is the Dalvi-Suciu dichotomy.
  • Extensional evaluation. The lifted rules compute P(Q)P(Q) from the probabilities of smaller queries, without building the lineage. For a fixed query that the rules accept, the time is polynomial in the database (Suciu, Olteanu, Re and Koch 2011, Chapter 4).
  • Intensional evaluation. Every query can be evaluated by computing ΦQ\Phi_Q and then its probability, by compilation or by exact model counting. The time is exponential in the worst case.
  • Approximation. For a union of conjunctive queries, ΦQ\Phi_Q is a DNF of polynomial size, and the probability of a DNF under independent variables has a fully polynomial randomized approximation scheme, by the estimator of Karp, Luby and Madras (1989) (see Karp-Luby algorithm and FPRAS). So P(Q)P(Q) can be approximated within a factor 1±ε1 \pm \varepsilon with high probability in time polynomial in the database and 1/ε1/\varepsilon, also for the #P-hard queries.
  • BID databases. The rules extend to BIDs, with one more rule that adds the probabilities of the disjoint tuples of a block (Suciu, Olteanu, Re and Koch 2011, Chapter 4). A TID is a BID, so every query that is #P-hard on TIDs stays #P-hard on BIDs.

References

  1. Dan Suciu, Dan Olteanu, Christopher Re and Christoph Koch, Probabilistic Databases, Synthesis Lectures on Data Management, Morgan and Claypool (2011), Chapter 2 (possible worlds, tuple-independent and block-independent-disjoint databases), Chapter 3 (the query evaluation problem and lineage), Chapter 4 (extensional evaluation and the lifted rules), Chapter 5 (intensional evaluation and compilation)
  2. Nilesh Dalvi and Dan Suciu, Efficient query evaluation on probabilistic databases, Proceedings of the 30th International Conference on Very Large Data Bases (VLDB), 864 to 875 (2004), the possible worlds semantics for independent tuples, safe plans, and the
  3. Nilesh Dalvi and Dan Suciu, Efficient query evaluation on probabilistic databases, The VLDB Journal 16(4), 523 to 544 (2007), journal version, with the dichotomy for conjunctive queries without self-joins
  4. Richard M. Karp, Michael Luby and Neal Madras, Monte-Carlo approximation algorithms for enumeration problems, Journal of Algorithms 10(3), 429 to 448 (1989), the union of sets estimator, which approximates the probability of a DNF formula

Where this leads

About this page

The build computes these levels from the evidence in the repository. Each row says what the next level needs. Read what the levels mean.

LadderLevelWhat the next level needs
Human proofH0 no proof
  • add a proof in proofs/ (06.5)
LeanL0 no Lean part
  • name a Lean module in the lean field (07)
VisualV0 none
  • add viz/scene.ts or a figure (10)
WritingW4 complete
  • a review of the text: no review record reviews/1X7PAG/text.yaml