Abstract
A consistent query-result cache that keys cached queries on their post-bind SQL text holds one entry per distinct literal value, so a point-lookup workload registers thousands of queries on one relation that differ only in a constant, each evaluated against every committed row change from the origin's change stream. This disclosure describes a representation in which each query shape (the query with its predicate literals replaced by ordered placeholders) is held once, with its resolved form, SQL text, prepared statement and change-evaluation classification, while the per-literal argument tuples are stored separately in an indexed argument set. Serving identity, generation, state, memoized responses and materialized results remain per argument tuple. Change evaluation is grouped by shape: for shapes whose arguments appear only in equality comparisons, the tuples a changed row matches are found by one hash lookup keyed on the row's values; other shapes are evaluated tuple by tuple against a predicate compiled once; and databaseside membership evaluation runs one prepared statement over the changed rows and the shape's argument arrays. Matches map back to entries for exact invalidation, dirty marking and memo eviction. For the decision whether a changed row belongs in the shared perrelation cache table, only queries not contained in another registered, ready, non-LIMIT query are evaluated.
Creative Commons License

This work is licensed under a Creative Commons Attribution 4.0 License.
Recommended Citation
Nelson, James, "Shape-and-Arguments Representation of Cached Queries in a Consistent Query-Result Cache, with Shape-Grouped Change Evaluation and Dominance-Pruned Row Placement", Technical Disclosure Commons, ()
https://www.tdcommons.org/dpubs_series/13553