Area: Ingestion
Sub-Area: Snowflake Profiling
Applies to: OSS + Cloud
Issue
The row count and column statistics (null count, distinct count, min, max) on a Snowflake dataset don't match what you expect from querying the table in Snowflake.
You Might Be Asking
- Why don't the profiling numbers match my table?
- Why does nullCount look too small next to rowCount?
- Why does a view or external table have no stats?
- How do I get column statistics computed on the full table?
Cause
Snowflake profiling samples large tables by default. use_sampling defaults to true and sample_size defaults to 10000. Tables with more rows than sample_size have their column statistics computed on a sample. Tables at or below sample_size are profiled in full.
In a sampled profile, the two kinds of number measure different things:
-
rowCountcovers the whole table. It comes from the row count in Snowflake metadata (information_schema.tablesROW_COUNT). -
nullCount,uniqueCount, min, max, mean and the other column statistics cover only the sample (by default at most 10,000 rows).nullCountis not a fraction ofrowCount, so it usually looks too small next to it.uniqueCountis the distinct count in the sample and is not scaled up. UsenullProportionto compare null rates.
When a table is profiled in full (its row count is at or below sample_size, or use_sampling: false), rowCount comes from a COUNT(*) on the table.
The Snowflake connector never profiles views, so a view has no profile and no stats. External tables are profiled only when profiling.profile_external_tables is true.
Two other settings also change which tables get numbers:
-
profile_table_size_limit(default 5 GB) andprofile_table_row_limit(default 5,000,000 rows) stop column-level profiling on large tables. A table over either limit still gets a table-level profile with row count, column count and size. Set either tonullonly if you need column statistics on large tables, at higher warehouse cost. -
profiling.profile_if_updated_since_days(defaultnull, no limit) profiles only tables that changed within the last N days. With1, tables that didn't change in the last day get no new profile.
profiling.max_workers only sets the number of profiling threads (default 5 x CPU count). It does not affect accuracy.
Solution
- Check whether the table is larger than
sample_size(10,000 rows by default). If it is, a difference betweenrowCountand the column statistics is expected. See rowCount and column statistics. - To compute column statistics on the full table, set
use_sampling: false. This costs more warehouse time. - Large tables over
profile_table_size_limitorprofile_table_row_limitstill show a row count but no column statistics. To get column statistics on them, raise the limits or set them tonull. Removing the limits is not needed for row counts. - Remove
profile_if_updated_since_daysif you want every table profiled on each run. - Run ingestion again after any change.
Example recipe:
source:
type: snowflake
config:
account_id: "xy12345.us-east-2.aws"
warehouse: "your_warehouse"
role: "datahub_role"
username: "datahub_user"
password: "${SNOWFLAKE_PASSWORD}"
profiling:
enabled: true
use_sampling: false
profile_table_size_limit: null
profile_table_row_limit: null
Snowflake is deprecating password authentication. For key-pair setup, see Migrating to key-pair auth.
If you use profile_pattern, put it at the top level of the source config beside profiling, not inside it. Only tables that table_pattern allows are considered.
Where the numbers show in the UI
Profile statistics show on the dataset's Columns tab and on the Stats tab. The Stats tab is enabled when a full-table profile, a partition profile, usage statistics or operations exist.