DWHPro synthetic insert-only MERGE evidence

Run: python3 -m pip install -r requirements.txt; python3 benchmark.py
Supply TD_HOST, TD_USER and TD_PASSWORD securely through your environment.
Do not run Python with -O: this research harness uses assertions for correctness.
Run only in a dedicated, disposable lab with DBA permission. The script creates a randomly named user below DBC, enables DBQL for that user and drops the user on completion. Never point it at production. Existing schemas are not removed. FLUSH QUERY LOGGING WITH ALL flushes the global DBQL cache; collection is filtered to the disposable user's tagged INSERT, MERGE, BT and ET requests. Expected DBQL request counts are specific to the recorded driver and fixture; a changed count stops this harness for investigation. Administrative objects and DBQL metadata require appropriate permissions.

Files: benchmark.py is the full executable source. queries.sql shows bound SQL; ? markers are bound by Python, not pasted directly into BTEQ. CSV files expose the deterministic input, initial target and expected target. evidence/results.json contains all 24 timings (round0 warmup; rounds1-5 measured), correctness and cleanup checks, plus per-run DBQL metrics. explain files are estimates captured before the timed runs, with100 target rows and275 staging rows for the set-based plan. No statistics collection, cache flushing of database data, enforced quiet host or workload isolation was performed. Setup, login, DDL, target reset, EXPLAIN, query-band changes and validation reads are outside the timer. Loading, staging-row list construction and transaction commit are inside it. One worker/session; no artificial network delay.

Fixture:100 initial keys retain negative metric values. Incoming keys1..250 carry metric=key*10; later keys151..175 conflict with metric999999. First arrival wins in input order for newly inserted keys. Existing target rows are unchanged. Expected final target:250 rows,150 new rows. Replay repeats the same fixed input order. The QUALIFY sort uses a unique synthetic arrival_seq for deterministic first-arrival choice within the staged batch. This is insert-only, not update/delete CDC.

Median resources summarize five complete runs per method. AMP CPU and parser CPU are seconds; TotalIOCount is the DBQL I/O counter, not bytes or network I/O. Resources include logged BT/ET but exclude administrative setup and validation. Array execution is one client call in this fixture; no general one-call/one-network-packet guarantee is implied. Times are client elapsed seconds. These are Python-driver database tests, not NiFi, Kafka, JDBC, processor, concurrency, recovery or production benchmarks. No exactly-once delivery claim. Rollback checks inject one invalid numeric statement after loading inside each explicit transaction; they do not simulate process crash, disconnect, deadlock or ambiguous commit.

Environment: Teradata Database20.00.28.81,4 configured AMPs; database VM4vCPUs/8GiB assigned; shared virtualized lab, existing swap in use. Client Linux on lab host; ordinary teradatasql20.0.0.72 parameter binding, BTET session. Reproduce with your own release and data distribution. Raw timings and plans are evidence for this fixture only.
