Repository navigation
fix(snowflake): read relation statistics with SHOW OBJECTS - #1417
Merged
Merged
Conversation
Metadata row counts ran one information_schema.tables query per relation, which needs a running warehouse: a code location sampling statistics kept the warehouse busy for about a second per relation. SHOW OBJECTS returns the same rows and bytes from metadata alone. Views and other non-table objects still report no row count; a relation without a schema keeps the information schema read.
kvlonge
enabled auto-merge (squash)
November 11, 2026 12:34
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.
Why
Snowflake metadata row counts ran one
information_schema.tablesquery per relation, and each one needs a running warehouse. A code location sampling statistics therefore kept the warehouse busy for about a second per relation.SHOW OBJECTSreturns the same rows and bytes from metadata alone, so no warehouse has to run.Changes
estimate_relation_row_counton Snowflake readsSHOW OBJECTS LIKE '<name>' IN SCHEMA <database>.<schema>and matches the stored name exactly. KindTABLEreports rows and bytes, with basisshow_objects_bytes. Views report no count, as before.LIKEwildcard, the backslash name and the schema-less read.DuckShop edge case: not applicable. This changes how one adapter reads metadata, not a project shape, data value or lifecycle.
Verification
pytest tests/unit/src/sqlbuild/adapters/test_relation_row_count_estimate.py tests/unit/src/sqlbuild/adapters/snowflake: passes. The statistics publication integration tests pass.SHOW OBJECTSmatchedinformation_schema.tablesexactly for every relation (28 tables with rows and bytes, 35 views with no count).make check-ci: passes.