Bag containment of conjunctive queries

Still openEvidence checked

Subjects: Logic and computation · Algorithms and data structures

Collections: Limits of computation

Reading depth

The problem

A table contains the row (a, b) twice and (a, c) once. A query that keeps just the first column returns a three times. A second query chooses two rows with the same first column and returns that column once for each ordered pair. Rows may be reused, so it returns a nine times. Both answers contain only the value a, but their repetition counts differ.

Can a program always decide whether one such query returns each answer no more often than another, on every possible finite table, including tables with duplicate rows?[1]

Scope

Pure conjunctive queries over finite bag databases: relations and answers permit duplicate tuples. Containment compares every output tuple’s multiplicity on every database, without unions, negation or arithmetic inequalities.

What remains open

The general decision problem remains open.[2]

Why it matters

It matters when query rewrites must preserve repeated answers, rather than merely the set of answers.[1]

Definitions

3 terms
bag semantics

Semantics in which a relation or query answer is a multiset: the same tuple can occur several times. In bag-bag containment, both input relations and query results retain multiplicities.[1] [2]

projection

Keeping selected columns and hiding the others. Under bag semantics, different row occurrences yielding the same retained tuple contribute to its total multiplicity.[1]

conjunctive query

A query built by requiring a conjunction of table-row conditions and hiding variables not returned in the answer. The pure queries in this target have no unions, negation or arithmetic inequalities.[1] [2]

Sources

  1. Bag Containment of Join-On-Free Queries George Konstantinidis and Fabio Mogavero
    Notes on Bag Containment of Join-On-Free Queries

    Published primary paper proves decidability for a restricted containee query class.

  2. Attacking Diophantus: Special Cases of Bag Containment George Konstantinidis, Xinzhuo Li and Fabio Mogavero · 2026-09-25
    Notes on Attacking Diophantus: Special Cases of Bag Containment

    Preprint defines the bag-bag/bag-set distinction and leaves general conjunctive-query containment open.

Related problems

Suggest a correction