TL;DR
This paper tackles the challenge of querying databases where the order of items is only partially known—a common scenario when merging rankings or sensor logs from different sources. The authors define a formal framework for "order-incomplete" data and show that while finding possible or certain answers is generally hard (NP-complete/coNP-complete), many practical queries remain efficient (PTIME) if the data is "almost" ordered or the query avoids specific complex operators.
What Problem Does This Paper Address?
In standard databases, we often treat data as unordered sets or bags. However, many real-world applications rely on order: think of a travel website ranking hotels by relevance, a log of sensor readings, or a history of document edits.
The problem arises when we combine these sources. If Website A ranks "Hotel X" above "Hotel Y," and Website B ranks "Hotel Z" at the top, how do we query the combined list? We know X > Y, but we don't know how Z compares to either. This is order-incomplete data.
The authors aim to answer two fundamental questions for such data:
- Possibility (POSS): Is it possible for a specific ordered list to be the result of my query?
- Certainty (CERT): Is a specific result the only possible outcome, regardless of how the missing order information is filled in?
Methods
The authors introduce po-relations (partially ordered relations). A po-relation consists of a set of data rows (tuples), each with a unique internal identifier, and a partial order that describes which rows must come before others.
To query this data, they extend Positive Relational Algebra (PosRA)—which includes standard operations like selection, projection, and union—to handle partial orders. They also introduce two types of product operators:
- Direct Product: Two items are comparable only if their components were comparable in the original sets.
- Lexicographic Product: A primary-sort/secondary-sort approach.
Crucially, they add an accumulation operator. This is a generalized version of SQL aggregates (like SUM or STRING_AGG) that processes a list and returns a single value based on a mathematical structure called a monoid. Because the input order is uncertain, a single query might result in multiple possible aggregate values.
Datasets
This is a theoretical study focused on computational complexity. The authors do not use large-scale empirical datasets. Instead, they use illustrative examples involving Paris restaurants and hotels to demonstrate how partial orders propagate through queries.
Key Insights and Ideas
- The "Bag" Necessity: In partially ordered data, you can't just use sets. You need "bag semantics" (where the same value can appear multiple times) because the same restaurant might appear at different ranks in different lists. The authors use internal identifiers to track these specific occurrences.
- The Complexity of "Maybe": Checking if a result is possible is generally NP-complete. This is because matching a candidate list to a partial order is essentially a search problem over all possible ways to "linearize" the order.
- Tractable Islands: The paper identifies specific conditions that make these problems easy (PTIME):
- Bounded Width: If the data is "almost" a total order (e.g., a few independent lists merged together), queries are efficient.
- Cancellative Monoids: If your aggregation function is "cancellative" (like addition, where $a+b = a+c$ implies $b=c$), checking for certain answers becomes much easier.
- Duplicate Elimination is Dangerous: In a partially ordered world, "SELECT DISTINCT" can actually fail. If two identical tuples have contradictory order relationships with a third tuple, they cannot be merged into a single representative without violating the logic of the partial order.
Key Results
The paper provides a comprehensive map of complexity (summarized in the paper's Table 1):
- General PosRA: Determining if a list is a possible answer is NP-complete.
- Aggregation: Determining if an aggregate value is certain is coNP-complete in general, but falls to PTIME if the aggregation uses a cancellative monoid.
- Restricted Operators: If the query avoids the "Direct Product" and the input data has a fixed "width" (a measure of how unordered it is), both possibility and certainty can be computed in polynomial time.
Limitations and Future Work
The authors acknowledge that their model currently only handles uncertainty in order, not in the data values themselves (like missing values or "nulls"). A major future direction is combining this order-aware algebra with probabilistic databases or other models of incomplete information.
Additionally, the "failure" state of their duplicate elimination operator is a design choice that ensures mathematical consistency but might be frustrating for end-users. Developing more "forgiving" semantics for merging duplicates in partial orders remains an open challenge.
Summary updated