PG doc: add note on statistics and snapshotting in PG considerations#35804
Open
martykulma wants to merge 2 commits intoMaterializeInc:mainfrom
Open
PG doc: add note on statistics and snapshotting in PG considerations#35804martykulma wants to merge 2 commits intoMaterializeInc:mainfrom
martykulma wants to merge 2 commits intoMaterializeInc:mainfrom
Conversation
|
Thanks for opening this PR! Here are a few tips to help make the review process smooth for everyone. PR title guidelines
Pre-merge checklist
|
5aa9b79 to
2e72144
Compare
kay-kim
reviewed
Mar 31, 2026
Contributor
kay-kim
left a comment
There was a problem hiding this comment.
left a suggestion (feel free to ignore if I missed the point) and a question.
| using ranges of | ||
| [`CTID`](https://www.postgresql.org/docs/current/ddl-system-columns.html#DDL-SYSTEM-COLUMNS-CTID). | ||
| Materialize uses [estimates](https://www.postgresql.org/docs/current/row-estimation-examples.html) | ||
| for the amount of data and rows that will be read. Missing or stale statistics will result in |
Contributor
There was a problem hiding this comment.
Not sure but maybe?
The PostgreSQL source performs parallel snapshotting of tables by distributing rows among workers using ranges of [`CTID`](https://www.postgresql.org/docs/current/ddl-system-columns.html#DDL-SYSTEM-COLUMNS-CTID). Materialize uses [PostgreSQL statistics to estimate](https://www.postgresql.org/docs/current/row-estimation-examples.html) the amount of data and number of rows to read. Missing or stale statistics can result in uneven work distribution, reducing snapshot performance. They can also cause incorrect snapshot progress reporting in the Console.
To avoid this situation, before creating the source in Materialize, ensure statistics are up to date by running PostgreSQL `ANALYZE` command.
Also, do you think in the actual postgres ingest tutorials, we should mention this Analyze step?
Contributor
Author
There was a problem hiding this comment.
Are the tutorials you're referencing the vendor specific steps (e.g. https://preview.materialize.com/materialize/35804/ingest-data/postgres/alloydb/)? I put it in considerations as that section appears for each of the vendors. If there's another tutorials area, seems like we may want to put it there as well!
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adds a section in PostgreSQL source considerations to highlight the relationship between parallel snapshot, console snapshot reporting, and up to date PostgreSQL table statistics.