Optimize sink datasets
Full knob taxonomy for sink tuning (correctness, shape, throughput, sampling), recommended config profiles, a sizing playbook, and common anti-patterns.
This guide is the customer-facing reference for shaping the destination dataset so it lands cleanly and stays cheap to query later. It covers the two knob families that decide what the destination looks like: Correctness (which rows land, and how they are reconciled) and Shape (how the dataset is physically laid out).
For knobs that govern how fast and how cheaply the run completes, including file sizing, workers, parallelism, and sampling, see Pipeline optimization. Optimizing for time covers throughput and validation-sampling knobs. Optimizing for resource covers memory/CPU and width-sampling knobs. The hub holds the recommended tuning profiles.
This guide does not cover destination-native maintenance. This includes Iceberg compaction, Snowflake auto-clustering jobs, BigQuery materialized view refreshes, and Redshift VACUUM. Those are scheduled by the destination owner, not by the Nilus pipeline.
When NOT to optimize
For most pipelines, the defaults are correct. Tune only when you see a concrete symptom, not pre-emptively:
Repeated runs duplicate rows or fail to refresh → look at
incremental_strategy,incremental_key,primary_key(Correctness knobs).Destination table or column names do not match the source (
pkeybecamep_key) → look atSCHEMA_NAMING(Correctness Knobs).Destination is hard to query / scans too much → look at
partition_by,cluster_by,max_table_nesting(Shape knobs).Run is slow, runs out of memory, or produces too many small files → that is a throughput/resource concern; see Pipeline optimization.
If the destination is queryable, the data is correct, and your bills are reasonable, leave the configuration alone.
The knob taxonomy
Nilus exposes 20-plus options across source.options, sink.options, and pipeline runtime environment variables. They group into four jobs:
Correctness
Get the right rows into the destination
incremental_strategy, incremental_key, primary_key, type_hints, interval_start, interval_end, mask, SCHEMA_NAMING
This guide
Shape
Decide how the destination dataset is physically laid out
partition_by, cluster_by, max_table_nesting
This guide
Throughput
Decide how fast and how cheaply the run completes
loader_file_format, loader_file_size, page_size, extract_parallelism, staging_bucket, LOAD__WORKERS, NORMALIZE__WORKERS, LOAD__PARALLELISM_STRATEGY
Sampling
Limit extraction volume for testing, validation, or partial backfills
sql_limit, yield_limit, sql_exclude_columns, sql_reflection_level
This guide documents the Correctness and Shape knobs in detail. Throughput and Sampling are covered by the Optimizing for time and Optimizing for resource guides. Every knob is documented with its placement (source.options / sink.options / env var), default, valid values, and the symptom it solves.
Detailed knob reference
Each knob is documented with its placement (source.options / sink.options / env var), default, valid values, and the symptom it solves.
Correctness knobs: get the right rows into the destination:
incremental_strategy,incremental_key,primary_key,type_hints,interval_start/interval_end,mask,SCHEMA_NAMING.Shape knobs: lay out the destination dataset:
partition_by,cluster_by,max_table_nesting.Tuning large Lakehouse (Iceberg) loads: wide/narrow file sizing and benchmark-backed configs for Iceberg destinations.
Anti-patterns
Using
mergewithout a usableprimary_key: the run does not fail. Nilus warns and falls back to append, which duplicates rows.query:never infers a table primary key.Putting optimization options under the wrong section: for example,
incremental_strategyundersource.options. The stack schema rejects unknown keys in bothsink.optionsandsource.optionsbecauseadditionalPropertiesisfalse.Adding multiple
partition_byrules pre-emptively: partitions cost write-side performance for no read-side benefit until consumers actually filter on them.Raising
max_table_nestingon nested payloads without inspecting arrays: the default"0"keeps nested objects asjson. Values"1"and"2"flatten objects and can split arrays into extra child tables. See Shape knobs.Switching a table read to
query:(or the reverse) on the same Lakehousedest_table: the two paths write different decimal precision and scale values, plus different_nilus_*columns. Iceberg commits can fail with a scale serialization error orcannot add required column: _nilus_load_id. Use a newdest_table. See Schema evolution.
Related Docs
Pipeline optimization: run speed/cost, tuning profiles, and the sizing playbook.
Tuning large Lakehouse (Iceberg) loads: wide/narrow file sizing and benchmark-backed configs for Iceberg destinations.
Batch pipeline config, CDC pipeline config, and Stream pipeline config: full pipeline references.
Batch sample configs, CDC sample configs, and Stream sample configs: copy-pasteable starting points.
PostgreSQL partitioned tables for CDC: setup for PostgreSQL partitioned CDC sources.
Sources overview and Destinations: per-connector pages with troubleshooting and incremental-strategy support tables.
Last updated
Was this helpful?