Area: Ingestion
Sub-Area: Performance
Applies to: OSS + Cloud
Issue
Large ingestion jobs take too long, use too many resources, or time out. You need to know which recipe settings reduce the work a run does.
You Might Be Asking
- How do I speed up ingestion for a large catalog?
- What is causing my ingestion to be slow?
- Can I parallelize ingestion?
- Does stateful ingestion make runs incremental?
Cause
A run does more work when its recipe covers more than you need: broad database, schema and table patterns, usage and lineage extraction you don't use, a wide usage time window, or profiling of large tables.
Source configs reject unknown keys. A misspelled or invented key under source.config fails recipe validation with an extra-fields error before the run starts. Use only keys listed on the Snowflake source config page (or the page for your source). The datahub-rest sink behaves the other way: it silently ignores unknown keys.
Stateful ingestion does not make extraction incremental. See step 6.
Solution
1. Reduce the scope of the run
Filter with allow and deny regex patterns. table_pattern matches the full database.schema.table name. Patterns match from the start of the string and are case-insensitive by default. Use single quotes around regexes in YAML.
Example for Snowflake.
source:
type: snowflake
config:
database_pattern:
allow: ['PROD_DB', 'ANALYTICS_DB']
deny: ['.*_TEMP$', '.*_BACKUP$']
schema_pattern:
allow: ['PUBLIC', 'ANALYTICS.*']
deny: ['.*_STAGING$']
table_pattern:
deny: ['.*\.TMP_.*']
2. Turn off features you don't need
include_table_lineage and include_usage_stats default to true on Snowflake. Profiling is off by default (profiling.enabled: false).
source:
type: snowflake
config:
include_table_lineage: false
include_usage_stats: false
profiling:
enabled: false
3. Keep the usage window small
-
bucket_durationdefaults toDAY. -
start_timedefaults to the last full day (UTC), not 30 days. It accepts relative values such as-7d. A value like-7dmakes the window wider than the default, so use it only when you need that history. -
end_timedefaults to now (UTC). It accepts only an absolute datetime. A relative value such as-1dis not valid. -
top_n_queries(default 10) andinclude_top_n_queries(default true) are top-level Snowflake keys. Put them directly underconfig.
source:
type: snowflake
config:
include_usage_stats: true
top_n_queries: 5
4. Reduce profiling cost
If you need profiling, limit it. All keys below go under profiling except profile_pattern, which goes directly under source.config.
source:
type: snowflake
config:
profile_pattern:
allow: ['PROD_DB\.PUBLIC\..*']
profiling:
enabled: true
profile_table_size_limit: 5
profile_table_row_limit: 5000000
turn_off_expensive_profiling_metrics: true
-
profile_table_size_limitis a size in GB, default 5.nullmeans no limit. Tables larger than the limit are skipped, not sampled. -
profile_table_row_limitskips tables with more rows than the limit. It does not sample. Default 5000000.nullmeans no limit. - On Snowflake and BigQuery, a table over either limit still gets a table-level profile (row count, column count, size). Only column-level profiling is skipped.
-
use_sampling(default true) andsample_size(default 10000 rows) apply only on BigQuery and Snowflake. Column-level stats are computed on the sampled rows. -
turn_off_expensive_profiling_metrics: trueturns off quantiles, distinct value frequencies, histograms and sample values. It limits profiling to 10 columns unless you setmax_number_of_fields_to_profile. -
profile_if_updated_since_daysskips tables not updated in that many days on Snowflake and BigQuery. On Dremio it compares against DataHub's last-profiled timestamp, so there it controls how often profiling runs. -
operation_configruns profiling less often inside a daily schedule. Setlower_freq_profile_enabled: trueandprofile_day_of_week(0 is Monday, 6 is Sunday) orprofile_date_of_month(1 to 31). On other days, profiling is skipped for that run. -
profiling.max_workerssets profiling workers. Its default is 5 x CPU count. - Don't set
profile_table_level_only: truetogether withmax_number_of_fields_to_profileor anyinclude_field_*set to true. Validation fails. - The run report counts tables skipped for profiling:
profiling_skipped_table_profile_pattern,profiling_skipped_not_updated,profiling_skipped_size_limit,profiling_skipped_row_limit. Setreport_dropped_profiles: trueto list tables and columns that were not profiled.
For more options, see SQL Profiling.
5. Split large ingestions
Run separate recipe files, each with its own database_pattern. You can run them in parallel or one after another.
# recipe-prod.yml
pipeline_name: snowflake_prod
source:
type: snowflake
config:
database_pattern:
allow: ['PROD_DB']
# recipe-analytics.yml
pipeline_name: snowflake_analytics
source:
type: snowflake
config:
database_pattern:
allow: ['ANALYTICS_DB']
If you use stateful ingestion, each recipe needs its own pipeline_name.
6. Understand stateful ingestion
Stateful ingestion is not incremental extraction. It soft-deletes tables and views that were in the last successful run but are missing from the current one (remove_stale_metadata, default true). It is off by default. It is guarded by fail_safe_threshold (default 75.0): if more than that percent of previous entities are missing, removal is skipped and the state is not committed. pipeline_name is required, and changing it loses the previous state.
pipeline_name: snowflake_prod
source:
type: snowflake
config:
stateful_ingestion:
enabled: true
remove_stale_metadata: true
Leave out state_provider. Its datahub_api setting is optional. When you omit it, the run uses its own DataHub connection. Don't hardcode http://localhost:8080.
See Stateful Ingestion.
7. Check how the sink sends data
The datahub-rest sink defaults to mode: ASYNC_BATCH. max_threads and max_pending_requests (default 2000) apply only in async modes. max_per_batch (default 100) applies only in async batch mode. These control concurrency, not payload size.
With async ingest, a successful run does not prove every write landed. Later failures go to the Failed MCP topic and are not reported to the run. See DataHub APIs and the datahub-rest sink docs.
8. Test and measure
# Run extraction without writing to DataHub
datahub ingest -c recipe.yml --dry-run
# Run on a small number of work units (default 10)
datahub ingest -c recipe.yml --preview --preview-workunits 50
--dry-run skips writing to the sink. --preview limits the run to a few work units. datahub ingest has no --performance-profiling option. Use the run report to see what the run did and which tables profiling skipped.
Related Documentation
- Snowflake source config
- SQL Profiling
- Stateful Ingestion
- DataHub Rest sink
- DataHub APIs
- Memory profiling of an ingestion run
Tags: performance, optimization, ingestion, stateful-ingestion, tuning, large-scale, throughput