Skip to content

docs(memgql): cache attribute requirement + element ids as properties - #1706

Open
DavIvek wants to merge 5 commits into
mainfrom
docs/memgql-cache-attributes-and-element-ids
Open

docs(memgql): cache attribute requirement + element ids as properties#1706
DavIvek wants to merge 5 commits into
mainfrom
docs/memgql-cache-attributes-and-element-ids

Conversation

@DavIvek

@DavIvek DavIvek commented Jul 31, 2026

Copy link
Copy Markdown
Contributor

Documents two user-visible changes from the MemGQL cache and ClickHouse fixes in
memgraph/zero#71, and adds the changelog entry for that work.

What this documents

Caching now requires every cached label to declare attributes. The cache
copies only the columns the mapping names, so a label declaring none would land
in Memgraph carrying nothing but its id, and every property read back would be
NULL. MemGQL declines to cache that graph rather than serve property-stripped
rows, and names the label to fix; the query still runs against the source.

This is the one thing that tripped an external reporter whose mapping was
otherwise correct — the attributes-are-optional rule holds for querying but
not for caching, and nothing said so. It is documented in both places a reader
would look: the caching how-to, and next to the existing "routing needs declared
attributes" note in the schema-file reference, which is the same class of rule.

metaFields.id is now exposed as a property on vertices and edges, so
RETURN n / RETURN r include it and n.<id_column> reads it by name. Both
metaFields tables say so.

The cache's validation note was stale. It claimed the cache was "currently
validated with Iceberg sources; the mechanism generalizes to the other warehouse
connectors". It now runs in CI against PostgreSQL, MySQL, DuckDB, SQL Server,
ClickHouse and the native Iceberg connector — each replaying the same query
corpus from its cache that it runs against the source. The note also now states
that graph-native sources cannot be cached, which was never written down.

Changelog

A new ## Unreleased section covering the behaviour changes above plus the
fixes: ClickHouse's alphabetical column ordering, the cache dropping edges and
properties, count(DISTINCT <node>) and whole-element WITH n, count(…)
emitting invalid SQL, and the warm-up log counting rows read rather than written.

Two user-visible changes from the cache and ClickHouse fixes in
memgraph/zero#71, plus the changelog entry for that work.

Caching now needs every cached label to declare `attributes`. The cache
copies only the columns the mapping names, so a label declaring none would
be cached id-only and every property read back would be NULL; MemGQL
declines to cache rather than serve those rows. This is the one thing that
tripped an external reporter whose mapping was otherwise correct, so it is
documented both where caching is set up and next to the existing routing
note in the schema-file reference, which already covers the parallel
"declared attributes required" rule.

`metaFields.id` is now exposed as a property on vertices and edges, so
`RETURN n` includes it and `n.<id_column>` reads it by name.

Also replaces the note claiming the cache is validated only against
Iceberg: it now runs in CI against six sources, and graph-native sources
cannot be cached at all.
@vercel

vercel Bot commented Jul 31, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
documentation Ready Ready Preview Jul 31, 2026 1:51pm

Request Review

Rewrites the note added earlier in this branch. MemGQL no longer refuses
to cache a label that declares no attributes — it caches its ids and
topology, which is what traversals and graph algorithms run on, and treats
a read of an undeclared property as a cache miss served from the source.
Same rule routing applies, so the mapping format gains no obligation.

Also documents the new `cached_properties` column on SHOW GRAPH CACHES,
and corrects the claim that every `USE`-split part engages the cache
independently: UNION composites dispatch as a whole and never consult it
(memgraph/zero#75).
Catches the changelog up with two changes it was missing: SHOW GRAPH
CACHES now reports `hits` / `misses` as well as `cached_properties`, and
a warm table is no longer re-scanned from the source when a newly-touched
edge type pulls it in as an endpoint.

Also rewrites the cache-fidelity entry. It described the defect as "cached
nodes carried only their id", which now reads as contradicting the
behaviour change above it — caching a label id-only is supported. The
defect was answering property reads out of a fragment that never held
them.
@DavIvek
DavIvek marked this pull request as ready for review July 31, 2026 13:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant