4
Complexity of Conjunctive Queries
•Theorem
The query complexity of CQ is NP-hard.
The combined complexity of CQ is NP-complete.
•
•Proof
NP membership.  Let:
f = 9 x1 … 9 xk G1 Æ … Æ Gm
A = (A, R1A, …, RpA)
Step 1: guess k values a1, …, ak 2 A
Step 2: check if G1 Æ … Æ Gm is true after substituting x1 with a1, …, xk with ak