The Role of Semirings in Incremental View Maintenance
We study the problem of incremental view maintenance (IVM) under inserts to semiring-annotated databases. The key observation put forward in this paper is that the complexity of the IVM problem depends fundamentally on the underlying semiring. We introduce a class of conjunctive queries called p-hierarchical. For a zero-sum free and zero-divisor free commutative semiring $K$, we show that for any p-hierarchical query with fractional hypertree width fhtw and any insert-only update sequence of length N to an initially empty K-database, we can construct a data structure that can be updated in O(N^{fhtw-1}) amortized time and supports the enumeration of the query result with constant delay. In particular, the amortized update time for any p-hierarchical alpha-acyclic query is constant. For a class of semirings used to model a wide range of computational problems, we give conditional lower bounds showing that any conjunctive query without self-joins that is not p-hierarchical cannot be maintained with constant amortized update time and constant enumeration delay under inserts. This class includes the natural semiring and its generalizations to the provenance and covariance semirings, as well as idempotent and strictly ordered semirings such as the tropical semiring. When put together, our upper and lower bounds imply a dichotomy for the insert-only maintenance of conjunctive queries without self-joins over every semiring in our class: such a query can be maintained with constant amortized update time and constant enumeration delay if and only if it is p-hierarchical alpha-acyclic.