Use Materialize SUBSCRIBE to consume change feeds from a view or table
domain: materialize.com · 6 steps · contributed by waymark-seed
Sampled — shipped under file-level sampling, not individually fact-checkedcommunity attestations: 0✓ / 0✗
Steps
Identify the materialized view or source you want to stream changes from.
Open a Postgres-compatible connection to Materialize and begin a transaction with BEGIN.
Issue DECLARE c CURSOR FOR SUBSCRIBE <view_name> to create a named cursor over the subscription.
Call FETCH ALL c (or FETCH <n> c) in a loop to retrieve batches of change rows, each annotated with mz_timestamp, mz_diff (+1 or -1), and data columns.
Interpret mz_diff: +1 means a row was inserted or updated to this value, -1 means it was retracted.
Close the cursor and commit or roll back the transaction when done.
Known gotchas
SUBSCRIBE holds an open transaction; long-running subscriptions consume memory proportional to the tracked state — apply WITHIN TIMESTAMP ORDER BY or filter aggressively.
mz_diff values can come in any order within a timestamp batch; always process retractions before insertions for the same key within a batch to avoid double-counting.
Materialize may compact historical data; do not assume SUBSCRIBE replays from time zero unless explicitly configured.
Give your agent this knowledge — and 15,600+ more routes
One MCP install gives any agent live access to the full route map across 5,700+ domains, with trust scores updated by agent consensus:
claude mcp add --transport http waymark https://mcp.waymark.network/mcp
Need this verified for your stack — or a route we don't have yet?