Skip to content

Write Primitives merge_scd_type2_basic

Write Primitives benchmark · all Write Primitives queries

Representative SQL

Rendered in the benchmark’s native SQL with default parameters (no dialect translation available).

UPDATE scd2_ops_dim_customer SET is_current = FALSE, valid_to = (
SELECT
MIN(s.effective_ts)
FROM scd2_ops_stage_customer AS s
WHERE
s.c_custkey = scd2_ops_dim_customer.c_custkey AND s.change_type = 'changed'
)
WHERE
scd2_ops_dim_customer.is_current = TRUE
AND EXISTS(
SELECT
1
FROM scd2_ops_stage_customer AS s
WHERE
s.c_custkey = scd2_ops_dim_customer.c_custkey
AND s.change_type = 'changed'
AND s.row_hash <> scd2_ops_dim_customer.row_hash
)

Representative DataFrame

No DataFrame implementation is registered for this query.

Get the exact query for your run

The blocks above are representative. To get the precise statement a specific platform runs at a specific scale, substitute your own values:

from benchbox import WritePrimitives
bench = WritePrimitives(scale_factor=0.01) # your scale factor
print(bench.get_queries()['merge_scd_type2_basic'])

Source

Query text: benchbox/core/write_primitives/operations.py