Abstract

A consistent query-result cache that keeps the encoded response bytes of its hottest queries in process memory (a memo) must stop serving a memoized response the moment a committed change on the origin alters it. The simplest policy stamps each memo with a version slot per relation it read and bumps that slot on any change to the relation. It never serves stale bytes, but a heartbeat or counter written to a column no hot query reads evicts every memo over the relation on every write. This disclosure describes a ladder of eviction precision in which a memo stamps, and a change bumps, slots at one of several granularities: the relation; the relation column for value changes together with a membership slot bumped by every insert, delete and key change; a predicate match that evicts only when the changed row belongs or belonged to the query's result; and a value diff that evicts only when the response bytes would differ. Each rung costs more change-path work and is adopted per relation on measurement. The eviction decision is deliberately broader than the cache's grow-only invalidation decision, because a finished response is also stale on shrink and on an in-place value change. The same column dependencies drive attribute-level dirty marking of materialized results, and evicted hot entries are re-admitted by re-memoizing after apply or by applying the row delta to the stored response.

Creative Commons License

Creative Commons License
This work is licensed under a Creative Commons Attribution 4.0 License.

Share

COinS