Velocer › フラッシュカード › University of Wisconsin–Madison › CS 784: Foundations of Data Management · UW-Madison
CS 784: Foundations of Data Management · UW-Madison
CS 784 notes turned into cards. not everything, just the stuff that kept coming up. · 作成者: quiet_kernel · カード 141 枚
- What is the Chandra–Merlin Homomorphism Theorem used to characterize?It characterizes when a conjunctive query is contained in another conjunctive query: Q1 ⊆ Q2 iff there is a homomorphism from Q2 to Q1.
- What structural property enables tractable evaluation of conjunctive queries via the Yannakakis algorithm?Acyclicity of the query's hypergraph (as detected by the GYO reduction), which allows joins to be evaluated efficiently.
- What are AGM join size bounds?Information-theoretic upper bounds on the size of a join result, derived from the fractional edge cover of the query hypergraph.
- What is a worst-case optimal join algorithm?An algorithm whose runtime matches the AGM bound, running in time proportional to the maximum possible output size rather than the product of input sizes.
- What is Datalog?A recursive query language based on rules over relations, where a query is evaluated by repeatedly applying rules until a fixpoint is reached.
- What is the purpose of the Magic Sets optimization in Datalog?It rewrites Datalog rules to restrict computation to facts relevant to a given query, improving efficiency.
- What is stratified negation in Datalog?A restriction on negation where the program can be partitioned into strata so that negated predicates are fully computed in earlier strata, avoiding recursion through negation.
- What is the well-founded semantics for negation?A semantics for Datalog with negation that assigns every fact one of three truth values (true, false, undefined) and is defined for all programs.
- What does the MPC (Massively Parallel Computation) model capture?A model of computation for shared-nothing clusters with rounds of communication, where each machine has limited memory and the goal is to minimize the number of rounds.
- What is the HyperCube algorithm used for in MPC?It is a multi-round algorithm for evaluating joins in the MPC model by distributing data across machines according to join attributes.
- What is a tree decomposition of a query hypergraph used for?It provides a structural characterization enabling tractable query evaluation, generalizing acyclicity to bounded treewidth.
- What is the GYO reduction?An algorithm that repeatedly removes ears and nodes from a hypergraph to test whether a query is acyclic.
- What is a homomorphism between two conjunctive queries?A mapping from the variables of one query to the variables/constants of another that preserves the atoms, used to test query containment.
- What is a schema in the relational data model?A set of relation symbols, each with a fixed arity (number of attributes).
- What is a fact in the relational data model?A ground atom R(a1, ..., ak) where each ai is a constant from the domain.
- What is a relation instance under set semantics?A finite set of facts; duplicates are not allowed.
- What is the active domain adom(I) of a database instance I?The set of all constants that appear in I.
- In a conjunctive query written as q(x) :- R1(y1), ..., Rn(yn), what are the head and body?The head is q(x), the intensional output relation; the body atoms R_i(y_i) are subgoals over extensional input relations.
- What is the safety restriction for conjunctive queries?Every head variable must appear in at least one body atom.
- What is a valuation in the semantics of a conjunctive query?A mapping v from the query's variables to constants in the domain that acts as the identity on constants.
- How is the output q(I) of a conjunctive query defined using valuations?q(I) = { v(x) | v is a valuation such that for every body atom R_i(y_i), v(y_i) is in R_i^I }.
- What is a Boolean conjunctive query and what does it return?A CQ with a head of arity 0, q(). It returns {<>} (True) if a valid valuation exists, and the empty set (False) otherwise.
- What is a full conjunctive query?A CQ whose head contains all variables appearing in the body; it corresponds to a Select-Join query with no projection.
- What SQL fragment corresponds to conjunctive queries?SELECT DISTINCT ... FROM ... WHERE ... where the WHERE clause is a conjunction of equalities.
- Define monotonicity of a query.A query q is monotone if I ⊆ J implies q(I) ⊆ q(J).
- Are all conjunctive queries monotone?Yes, every CQ is monotone (and satisfiable).
- Why can't conjunctive queries express set difference or universal quantification?Because CQs are monotone, while set difference and universal quantification are non-monotone operations.
- What does the extension CQ≠ add to conjunctive queries?It adds inequality (≠) comparisons.
- What is a UCQ and which algebra does it correspond to?A Union of Conjunctive Queries; it is equivalent to SPJU algebra (Select-Project-Join-Union).
- What does it mean for query q1 to be contained in query q2 (q1 ⊆ q2)?For every database instance I, the result of q1 on I is a subset of the result of q2 on I: q1(I) ⊆ q2(I).
- When are two queries q1 and q2 equivalent (q1 ≡ q2)?When q1 ⊆ q2 and q2 ⊆ q1, i.e., they return the same result on every database instance.
- For Boolean conjunctive queries, what does containment q1 ⊆ q2 correspond to logically?Logical implication: q1 ⇒ q2.
- What is the canonical database D[q] of a conjunctive query q?The database where each variable in var(q) is treated as a distinct frozen constant, and each body atom of q becomes a fact in D[q].
- What is a homomorphism (containment mapping) h: q2 → q1 between two CQs?A mapping from var(q2) to var(q1) ∪ const(q1) that fixes constants, maps every body atom of q2 to a body atom of q1, and maps head(q2) to head(q1).
- State the Chandra–Merlin Homomorphism Theorem for CQs q1 and q2.q1 ⊆ q2 iff there exists a homomorphism h: q2 → q1 iff head(q1) ∈ q2(D[q1]).
- In the homomorphism test for q1 ⊆ q2, which direction does the homomorphism go and why is this surprising?It goes from q2 (the more general query) into q1 (the more constrained query) — a contravariant direction.
- What is the complexity of containment and equivalence for conjunctive queries?NP-complete.
- How is NP-hardness of CQ containment proved?By reduction from Graph 3-Colorability: a graph G is 3-colorable iff K3 ⊆ qG, i.e., there is a homomorphism h: qG → K3.
- When is a conjunctive query q minimal?When no equivalent CQ q' ≡ q has strictly fewer body atoms.
- How do you obtain a minimal equivalent query from a CQ q?By deleting redundant body atoms, i.e., folding q onto a core of itself via an endomorphism h: q → q'.
- What is the uniqueness property of minimal equivalent CQs?All minimal equivalent CQs are unique up to variable renaming (isomorphism).
- What is the containment condition for unions of conjunctive queries (UCQs)?∪q_i ⊆ ∪q'_j iff for every i there exists j such that q_i ⊆ q'_j.
- What is the complexity of UCQ containment?NP-complete.
- What is the complexity of containment for CQ≠ and CQ< (CQs with inequalities or order comparisons)?Π2^p-complete.
- What is the complexity of containment for full relational algebra / first-order logic, and why?Undecidable, by Trakhtenbrot's Theorem (finite satisfiability of FO logic is undecidable).
- What is data complexity of query evaluation?The query q is fixed (O(1)), and complexity is measured solely as a function of the database size |I|.
- What is query complexity of query evaluation?The database I is fixed, and complexity is measured as a function of the query size |q|.
- What is combined complexity of query evaluation?Both the query q and the database I are inputs, and complexity is measured as a function of both.
- What is the time complexity of naive conjunctive query evaluation?Enumerating all |adom(I)|^k valuations takes O(|q|^{k+1} |I|^k) time, where k = |var(q)|.
- What is the data complexity of conjunctive queries and full relational algebra (SQL without recursion)?It is in AC^0 — constant-depth, polynomial-size, unbounded-fan-in circuits, meaning the evaluation is embarrassingly parallel.
- What is the combined complexity of conjunctive queries?NP-complete.
- What is the combined complexity of relational algebra / first-order logic queries?PSPACE-complete.
- What does AC^0 mean in terms of parallelism?AC^0 is constant-depth, polynomial-size, unbounded-fan-in circuits, so problems in AC^0 are embarrassingly parallel.
- What are Vardi's three measures of query evaluation complexity?Data complexity (fixed query), query complexity (fixed database), and combined complexity (both query and database are inputs).
- What is the query hypergraph H(q) of a conjunctive query q?Vertices are the variables of q; each hyperedge corresponds to the set of variables appearing in one atom (relation) of q.
- What are the two operations in the GYO reduction algorithm?(a) Delete any isolated vertex (a variable appearing in at most one hyperedge). (b) Delete any hyperedge contained in another hyperedge.
- According to GYO reduction, when is a hypergraph acyclic?It is acyclic iff GYO reduction terminates with an empty hypergraph (all vertices and edges deleted).
- What is the running time of the GYO reduction algorithm, and is it order-dependent?It runs in linear time O(|q|) and is confluent (order-independent).
- What is the Running Intersection (Connectedness) Property of a join tree?For every variable x, the set of tree nodes (atoms) containing x forms a connected subtree; equivalently, if x is in two atoms, x appears in every atom on the unique path between them.
- How does the existence of a join forest characterize acyclic conjunctive queries?A CQ is acyclic iff it has a join forest (join tree) satisfying the Running Intersection Property.
- What is a dangling tuple in a conjunctive query evaluation?An input tuple that participates in no valid valuation of q(I), i.e., it contributes to no answer.
- Define the semijoin R ⋉ S.R ⋉ S = π_att(R)(R ⋈ S), which filters R to only those tuples that match some tuple in S.
- How does the existence of a full reducer via semijoins characterize acyclic CQs?A CQ is acyclic iff a finite sequence of semijoins (a full reducer) eliminates all dangling tuples for every database instance, leaving a globally consistent instance.
- What is a full reducer?A finite sequence of semijoins that removes all dangling tuples from every relation for every database instance.
- Which query is a counterexample showing that semijoins cannot always eliminate dangling tuples?The triangle query Δ, which cannot eliminate dangling tuples on a 2-cycle of twisted edges.
- What are the two phases of the Yannakakis algorithm?Phase 1: full reducer (bottom-up then top-down semijoin passes along the join tree). Phase 2: bottom-up join with early projection.
- Describe the semijoin passes in Phase 1 of Yannakakis' algorithm.A bottom-up pass where each parent is semijoined with each child (R_parent := R_parent ⋉ R_child), followed by a top-down pass where each child is semijoined with its parent (R_child := R_child ⋉ R_parent).
- What happens in Phase 2 of the Yannakakis algorithm?Traverse the join tree bottom-up (post-order); at each node, sequentially join with children and project onto the node's variables plus the query head variables.
- What is the combined complexity of Yannakakis' algorithm for a general acyclic CQ?O(|q| · |I| · |OUT|), polynomial in the query size, database size, and output size.
- What is the runtime of Yannakakis' algorithm for a Boolean acyclic CQ?O(|q| · N) time, linear in the database size N = |I|.
- What is the runtime of Yannakakis' algorithm for a full acyclic CQ?O(|q| · (N + |OUT|)) time.
- Why is early projection important in Phase 2 of Yannakakis' algorithm?It keeps intermediate results small by projecting onto only the variables needed for the node and the query head, enabling the polynomial combined complexity guarantee.
- What is a tree decomposition \((T, \chi)\) of a conjunctive query?A tree \(T\) whose nodes are labeled by bags \(\chi(v) \subseteq \text{var}(q)\) satisfying atom coverage (every atom's variables lie in some bag) and the running intersection property.
- What is the atom coverage condition in a tree decomposition?For every atom \(A\) in \(q\), there exists a node \(v \in V_T\) with \(\text{var}(A) \subseteq \chi(v)\).
- What is the running intersection (connectedness) property of a tree decomposition?For every variable \(x \in \text{var}(q)\), the set of nodes whose bags contain \(x\) induces a connected subtree of \(T\).
- How is the width \(w(v)\) of a bag \(\chi(v)\) defined in generalized hypertree width?It is the minimum number of query atoms needed to cover all variables in \(\chi(v)\), i.e., an integral edge cover of \(\chi(v)\).
- How is generalized hypertree width \(\text{ghw}(q)\) defined?\(\text{ghw}(q) = \min_{(T,\chi)} \max_{v \in V_T} w(v)\), the minimum over tree decompositions of the maximum bag width.
- What is the relationship between \(\alpha\)-acyclicity and generalized hypertree width?\(q\) is \(\alpha\)-acyclic if and only if \(\text{ghw}(q) = 1\).
- How are conjunctive queries evaluated via tree decompositions?Materialize each bag by joining up to \(k = \text{ghw}(q)\) covering atoms in \(O(|I|^k)\) time and size, turning the decomposition into an acyclic join tree, then run the Yannakakis algorithm.
- What is the complexity of evaluating a Boolean CQ with \(\text{ghw}(q) = k\)?\(O(|I|^k)\).
- What is the complexity of evaluating a full CQ with \(\text{ghw}(q) = k\)?\(O(|I|^k + |\text{OUT}|)\).
- What is a fractional edge cover of a hypergraph H(q) = (V, E)?A weight assignment u = (u_1, ..., u_ℓ) ∈ ℝ_{≥0}^ℓ, one weight per hyperedge e_j ∈ E, such that every variable x ∈ V is covered with total weight at least 1: ∑_{j : x ∈ e_j} u_j ≥ 1.
- What is the minimum fractional edge cover number ρ*(q)?ρ*(q) = min_{u} ∑_{j=1}^ℓ u_j, where u ranges over all fractional edge covers of H(q).
- State the AGM bound theorem for a full conjunctive query q with input relations R_j of size N_j.For every fractional edge cover u of H(q), |q(I)| ≤ ∏_{j=1}^ℓ N_j^{u_j}. When all relations have size ≤ N, the tightest upper bound is |q(I)| ≤ N^{ρ*(q)}.
- For the Loomis–Whitney join LW_k, where each of k atoms has k−1 variables, what fractional edge cover gives the AGM bound, and what is the bound?u_j = 1/(k−1) for each atom gives |LW_k(I)| ≤ N^{k/(k−1)} when all relations have size ≤ N.
- In the information-theoretic proof of the AGM bound, how is the random variable X defined and what is H(X)?X = (X_1, ..., X_n) is drawn uniformly at random from the output q(I), so H(X) = log_2 |q(I)|.
- In the entropy proof of the AGM bound, why is H(X_{e_j}) ≤ log_2 N_j for each hyperedge e_j?The marginal projection X_{e_j} takes values in R_j^I, which has size ≤ N_j, and the uniform distribution maximizes entropy.
- State Shearer's Lemma as used in the AGM bound proof.For any fractional edge cover u, H(X) ≤ ∑_{j=1}^ℓ u_j H(X_{e_j}).
- How does combining Shearer's Lemma with the entropy bounds yield the AGM bound?log_2 |q(I)| = H(X) ≤ ∑_j u_j H(X_{e_j}) ≤ ∑_j u_j log_2 N_j, so |q(I)| ≤ ∏_j N_j^{u_j}.
- What does it mean that the AGM bound is asymptotically tight?There exist worst-case instances (constructed via LP duality) on which the output size reaches the AGM bound up to constant factors, so the bound cannot be improved in general.
- Why are traditional binary join plans suboptimal for the triangle query with skewed star relations?Every pairwise binary join materializes Ω(n²) intermediate tuples, even though the AGM bound is O(n^{3/2}) and the true output size is 3n+1.
- What paradigm shift does WCOJ use to avoid the suboptimality of binary joins?Move from table-at-a-time binary joins to variable-at-a-time multiway joins (or skew-aware heavy/light splitting).
- Describe the GenericJoin framework's recursive partitioning.Recursively partition variables V into I ⊂ V and J = V \ I; solve the sub-query on I, then for each valid prefix tuple t_I recursively solve the residual query on J over filtered relations R_F ⋉ t_I.
- What is the base case requirement for GenericJoin when |V|=1?Intersecting unary relations ⋂_{F ∈ E} R_F must run in time Õ(min_{F ∈ E} |R_F|) ≤ Õ(∏_F |R_F|^{u_F}).
- How does Leapfrog Triejoin index relations?It fixes a global variable ordering x_1, …, x_n and indexes every relation as a sorted multi-level Trie aligned with that variable order.
- What is fractional hypertree width (fhw) and what runtime does it guarantee for full CQs?fhw combines tree decompositions with WCOJ inside each bag to evaluate any full CQ in time Õ(N^{fhw(q)} + |OUT|).
- What is the difference between EDB and IDB predicates in Datalog?EDB (Extensional Database) predicates appear only in rule bodies and represent input tables. IDB (Intensional Database) predicates appear in rule heads (and may recursively appear in bodies) and are computed by the rules.
- What is a linear Datalog rule?A rule in which at most one atom in the body is mutually recursive with the head, e.g., T(x,y) :- T(x,z), R(z,y).
- State the model-theoretic semantics of positive Datalog.Each rule is a universal Horn clause ∀x (Body → Head). The output P(I) is the unique minimal Herbrand model containing the input instance I.
- What is the Immediate Consequence Operator T_P in Datalog fixpoint semantics?T_P(J) applies all rules once in parallel to the current set of facts J, producing all facts derivable in one round. Iterating T_P from the empty set reaches the least fixpoint.
- Why does iterating T_P from the empty set reach a unique least fixpoint?T_P is monotone (I ⊆ J implies T_P(I) ⊆ T_P(J)) over the finite active domain adom(I), so the sequence T_P(∅), T_P²(∅), … converges to a unique least fixpoint in polynomially many steps, equal to P(I).
- What is the proof-theoretic semantics of positive Datalog?A fact is in the output iff it can be derived by a finite proof tree whose leaves are input facts and whose internal nodes are rule applications.
- What is the data complexity of positive Datalog?P-Complete. It is strictly more expressive than AC⁰ relational algebra and can compute transitive closure (STCON) and Andersen's points-to analysis.
- What is the combined complexity of positive Datalog?EXP-Complete.
- How does naive bottom-up evaluation work, and what is its main inefficiency?It recomputes each IDB predicate from scratch every round via P_i^(k) = q_i(P_1^(k-1), …, P_m^(k-1)) until no change. It wastefully re-derives old facts each round.
- What is the key idea of semi-naive bottom-up evaluation?It maintains differential tables ΔP_i^(k) = P_i^(k) \ P_i^(k-1) of newly discovered facts and rewrites joins so every derivation uses at least one new fact from the previous round, avoiding redundant re-derivation.
- Why does semi-naive evaluation process SCCs of the IDB precedence graph in topological order?Evaluating strongly connected components in topological order lets each SCC reach its fixpoint before dependent components are evaluated, avoiding unnecessary iterations across mutually dependent predicates.
- When is top-down Query-Subquery (QSQ) evaluation preferable to full bottom-up closure?When a query binds constants in the goal (e.g., q(y) :- T('a', y)), bottom-up closure wastes work on unreachable nodes; QSQ restricts computation to facts relevant to the bound query.
- What is the Magic Sets rewriting technique?It rewrites the Datalog program by turning QSQ's input and supplementary relations into explicit IDB rules, then runs standard bottom-up semi-naive evaluation on the rewritten program.
- Why does adding negation to Datalog rule bodies break monotonicity of the immediate consequence operator T_P?Negation makes T_P non-monotone, so adding facts can remove conclusions; fixpoints may not exist or may oscillate.
- Give an example showing that Datalog with negation may have no fixpoint.R(x) :- S(x), not R(x) on {S(1)} oscillates forever between the empty set and {R(1)}.
- Give an example of a Datalog with negation program with multiple incomparable minimal models.R(x) :- S(x), not T(x) and T(x) :- S(x), not R(x) on {S(1)} has minimal models {R(1)} and {T(1)}.
- What is semi-positive Datalog?A Datalog with negation fragment where negation appears only on EDB (input) relations, so negated relations can be replaced by their active-domain complement.
- How is the precedence graph of a Datalog with negation program defined?Nodes are relations; there is a positive edge R ->+ S if R appears positively in a rule for S, and a negative edge R ->- S if not R appears in a rule for S.
- State the stratifiability criterion for Datalog with negation programs.A program is stratifiable iff its precedence graph contains no directed cycle that includes a negative edge.
- How are stratified Datalog programs evaluated?Partition IDBs into strata along topological SCCs of the precedence graph; evaluate each stratum to fixpoint with semi-naive evaluation, then treat its output as EDB for higher strata.
- What is the complexity and stratification-independence property of stratified Datalog semantics?The output is independent of the chosen valid stratification and has PTIME data complexity.
- What is the Gelfond-Lifschitz reduct P^I of a Datalog with negation program relative to a candidate fact set I?Ground all rules over the active domain, delete any rule containing a negated atom not R(a) with R(a) in I, and strip all remaining negative literals.
- Define a stable model of a Datalog with negation program.I is a stable model iff gamma_P(I) = I, where gamma_P(I) is the least fixpoint of the positive program P^I.
- What is a shared-nothing architecture?A system of p independent servers, each with private RAM and disk, connected by a network.
- What is block/round-robin partitioning and its key property?Data is distributed evenly across nodes (n/p per node) with zero skew, but it does not support efficient equality or range lookups.
- How does hash partitioning distribute data, and what is its weakness?Each tuple is assigned to node h(A) in [p], giving fast equality/join lookup, but it is vulnerable to skew on the hashed attribute.
- How does range partitioning work and what queries does it support?Tuples are assigned using range-splitters k1 < ... < k(p-1), which supports range queries but is vulnerable to skew.
- In the MPC/BSP model, how does computation proceed?Computation proceeds in synchronous rounds, alternating local computation with global data exchange.
- What is the load L in the MPC model?The maximum amount of data received by any single machine in a round; the ideal linear-speedup target is L = O(n/p).
- How does parallel hash join handle R(x,y) join S(y,z)?Hash-partition both relations on join key y to p machines in one round, achieving load O((n_R + n_S)/p) if y is skew-free.
- What is the main weakness of parallel hash join?It fails under heavy-hitter skew, since a single frequent join-key value overloads one machine.
- How is the 1-round Cartesian product arranged across machines?Arrange p machines in a p_R x p_S = p grid; hash R to a row (replicated across p_S machines) and S to a column (replicated across p_R machines).
- What is the HyperCube (Shares) algorithm for multiway joins?Organize p machines into a k-dimensional hypercube with one share factor p_xi per query variable, and replicate each tuple across machines for variables not in its relation.
- How are tuples routed in the HyperCube algorithm?Each tuple fixes coordinates for its relation's variables via hashing and uses wildcards for missing variables, replicating across the product of share factors for absent variables.
- For the triangle query with all relations size N, what share factors are used?Set p_x = p_y = p_z = p^(1/3), so each share exponent is 1/3.
- What is the per-machine load for the triangle query under the HyperCube algorithm?L = O(N / p^(2/3)) in a single round.
- What is the key advantage of the HyperCube algorithm for the triangle query?It achieves the load in one round without materializing large two-way intermediate joins.
- What is the data complexity of Conjunctive Queries (CQ)?AC^0.
- What is the combined complexity of Conjunctive Queries (CQ)?NP-Complete.
- What is the containment complexity of Conjunctive Queries (CQ)?NP-Complete.
- Which algorithm/formalism characterizes containment of Conjunctive Queries?The Chandra–Merlin Homomorphism theorem (CQs are equivalent to SPJ algebra / existential positive FO).
- Which algorithm evaluates Acyclic CQs efficiently?The Yannakakis algorithm; acyclic CQs correspond to GYO reduction, join trees, and full reducers.
- What is the containment complexity of Acyclic CQs when the target is acyclic?PTIME.
- Which techniques are used to evaluate Positive Datalog?Least fixpoint of the immediate consequence operator T_P, with Semi-Naive evaluation, QSQ, and Magic Sets optimizations.
- What distinguishes Stratified Datalog^¬ from Unstratified Datalog^¬?Stratified Datalog^¬ has no negative cycles in its precedence graph and is evaluated by iterated fixpoints; unstratified Datalog^¬ requires stable models / Gelfond–Lifschitz reduct and the alternating fixpoint for 3-valued well-founded semantics.
Velocerは無料です。間隔反復と、あらゆる文書から作成できる自分だけのカードをご利用いただけます。
PDF to flashcards · Lecture to flashcards · Practice exam · Syllabus study plan · Anki import
University of Wisconsin–Madisonのほかのデッキ
- comp sci 240 midterm 1
- comp sci 240 midterm 2
- COMP SCI 240 Midterm 3
- COMP SCI 240 Final
- comp sci 300 full course review
- CS 639: Introduction to Reinforcement Learning · UW-Madison
- CS 839: Reinforcement Learning · UW-Madison
- CS 544: Intro to Big Data Systems · UW-Madison
- CS 580: Intelligent Robotics · UW-Madison
- CS 880: Quantum Algorithms · UW-Madison
- CS 765: Data Visualization · UW-Madison
- CS 639: AI Coding · UW-Madison