Hybrid DML is the next-generation write engine in Hologres. It unifies INSERT, UPDATE, and DELETE execution behind a single adaptive operator that picks the optimal join and deduplication strategy at runtime, eliminating out-of-memory failures when loading large tables.
Overview
What is Hybrid DML
Hybrid DML is a new write engine developed by Hologres for INSERT, INSERT ON CONFLICT, UPDATE, and DELETE operations. It consolidates write logic that was previously scattered across multiple operators into a single intelligent operator (DataSetHybridDMLNode) that adapts its join and deduplication strategy to the actual data volume at runtime, eliminating out-of-memory (OOM) failures when loading large tables.
In short:
Legacy DML: the query optimizer (QO) decides the join algorithm up front and the execution engine (SE) follows a fixed plan. When the data volume exceeds the optimizer's estimate, the query is prone to OOM.
Hybrid DML: the execution engine selects the join strategy adaptively based on real-time data volume, ensuring that the query never runs out of memory -- it may run slower, but it never fails.
Key benefits
Dimension | Legacy DML | Hybrid DML |
Stability | Large-table loads may hit OOM. | Adaptive strategy switching guarantees no OOM. |
Performance | Depends on optimizer estimates; inaccurate estimates degrade performance. | Adapts at runtime, delivering more predictable performance. |
Usability | Requires a DBA to tune join strategies manually. | Selects the strategy automatically; no manual tuning needed. |
Execution plan | Four separate DML operators produce complex plans. | A single unified operator keeps the plan simple. |
Benefits
Improved stability
With the legacy DML engine, when both the source (for example, a MaxCompute foreign table) and the target table are large, the Hash Join hash table can exceed the memory limit and cause the query -- or even the worker -- to OOM.
Hybrid DML embeds an adaptive decision engine (Game Machine) that monitors memory usage in real time as data is written batch by batch:
Small data volume: uses Hash Join for the best performance.
Medium data volume: automatically swaps the Hash Join build side, placing the smaller dataset in the hash table.
Large data volume: automatically falls back to Sort-Merge Join, which spills to disk and guarantees no OOM.
Performance gains
Scenario | Outcome |
Small-table load | Performance is on par with legacy DML (takes the Hash Join path). |
Large-table load (previously OOM) | Completes successfully instead of failing. Throughput is roughly one-third that of Hash Join. |
INSERT ON CONFLICT DO UPDATE (all-column update) | Triggers Blind Merge, skips the join, and delivers a significant speedup. |
Dynamic Table incremental refresh | Routes through Hybrid DML by default, making incremental writes more efficient. |
Usage
Enable and disable
No SQL changes are required. Continue using standard INSERT, UPDATE, and DELETE statements. Hybrid DML is toggled with a GUC parameter.
Hybrid DML is enabled by default in Hologres V3.1 and later. No manual configuration is required.
-- Enable Hybrid DML (on by default in Hologres V3.1 and later)
SET hg_experimental_enable_hybrid_dml = on;
-- Disable Hybrid DML and fall back to the legacy DML engine
SET hg_experimental_enable_hybrid_dml = off;Examples
-- Make sure Hybrid DML is enabled
SET hg_experimental_enable_hybrid_dml = on;
-- Plain load
INSERT INTO holo_table SELECT * FROM mc_table;
-- Upsert on primary key
INSERT INTO holo_table
SELECT * FROM source_table
ON CONFLICT (pk_col) DO UPDATE SET
col1 = EXCLUDED.col1,
col2 = EXCLUDED.col2;
-- Ignore conflicts
INSERT INTO holo_table
SELECT * FROM source_table
ON CONFLICT (pk_col) DO NOTHING;
-- Load from a Paimon foreign table
INSERT INTO holo_table SELECT * FROM paimon_table;Core GUC parameters
Parameter | Type | Default | Description |
| bool |
| Master switch for Hybrid DML. |
| bool |
| Whether UPDATE statements that modify a primary key column use Hybrid DML. Off by default; the statement falls back to the legacy path. |
| bool |
| Whether to use Runtime Filter (Bloom Filter) to accelerate Hash Join. |
| enum |
| Override the join strategy. Adjust only when necessary. |
Values supported by hg_experimental_hybrid_dml_join_mode:
Value | Behavior | When to use |
| Adaptive selection (recommended). | Almost all workloads. |
| Forces Sort-Merge Join with spill-to-disk. | Extremely tight memory or debugging. |
| Forces Hash Join; build side is selected automatically. | You have confirmed the data volume will not cause OOM. |
| Forces the source data to be the probe side; the target table builds the hash table. | The target table is relatively small. |
| Forces the target table to be the probe side; the source data builds the hash table. | The source data is relatively small. |
Best practice: keep auto mode so the engine adapts on its own.
Version behavior
Defaults by version
Version | Default behavior | Description |
Hologres V3.0 and earlier | Hybrid DML is not supported. | Only the legacy DML engine is available. |
Hologres V3.1 and later | Hybrid DML is enabled by default. | No manual configuration required; all DML statements take the Hybrid path. |
Feature support matrix
Feature | Hologres V3.0 and earlier | Hologres V3.1 and later |
Plain INSERT | Not supported | Enabled by default |
INSERT ON CONFLICT DO UPDATE | Not supported | Enabled by default |
INSERT ON CONFLICT DO NOTHING | Not supported | Enabled by default |
DELETE | Not supported | Enabled by default |
UPDATE (non-primary-key columns) | Not supported | Enabled by default |
UPDATE (primary key columns) | Not supported | Requires |
Blind Merge optimization | Not supported | Triggered automatically for all-column UPDATE |
Dynamic Table incremental refresh | Legacy path | Uses Hybrid DML by default |
Runtime Filter acceleration | Not supported | Enabled by default |
Sort-Merge Join fallback | Not supported | Triggered automatically for large-table loads |
Verify whether Hybrid DML is in use
Use EXPLAIN to inspect the execution plan:
EXPLAIN INSERT INTO holo_table SELECT * FROM source_table;Hybrid DML plan: contains a
DataSetHybridDMLNodenode.Legacy DML plan: contains
DataSetInsertNode,DataSetDeleteNode,DataSetUpdateNode, orDataSetMergeNode.
For a more detailed plan in Protobuf format:
EXPLAIN (FORMAT PB) INSERT INTO holo_table SELECT * FROM source_table;How it works (for DBAs)
Adaptive join decision flow
The adaptive decision engine in Hybrid DML makes its choice in real time as data is written. The flow is as follows:
Key decision points:
Source data smaller than target: buffer the source in a Buffer Table. After end-of-stream (EOS), build the hash table from the source and probe the target -- RIGHT OUTER JOIN.
Target table smaller than source: build the hash table by scanning the target, then probe with the source -- LEFT OUTER JOIN.
Memory insufficient: fall back to Sort-Merge Join. Each side is sorted independently, then merged. The operator spills to disk, so it never OOMs.
Runtime Filter acceleration
When Hash Join is selected and the source data is the build side, Hybrid DML generates Runtime Filters automatically:
Rowgroup Filter: converts the source primary key values into an IN-list filter and pushes it down to the target table's storage layer, skipping irrelevant row groups.
Bloom Filter: builds a Bloom Filter on the primary key column to prune non-matching rows early when scanning the target table.
Default trigger thresholds:
Target table contains at least 10,000 rows.
Source row count is less than 0.3 times the target row count.
Blind Merge optimization
An INSERT ON CONFLICT DO UPDATE statement triggers Blind Merge and skips the join with the target table entirely when all of the following conditions are met:
The UPDATE SET clause covers every non-primary-key column.
Primary key columns appear in the SET clause only as identity expressions (for example,
pk = EXCLUDED.pk).No subqueries or other complex expressions are used.
The reasoning behind Blind Merge: when every column will be overwritten anyway, the engine can skip reading the existing values from the target table and write the new row directly.
Limits and constraints
Functional limits
Limit | Description |
Offline writes only | Fixed Plan (online point query and point write) is not supported. |
UPDATE on primary key columns | Does not use Hybrid DML by default. Enable |
ON CONFLICT with subqueries | If the |
INSERT OVERWRITE | Source-side deduplication supports only |
Performance expectations
Scenario | Expected performance |
Small data volume (fits in memory) | On par with the legacy DML Hash Join path. |
Large data volume (triggers Sort-Merge Join) | Throughput is roughly one-third that of Hash Join, but the query is guaranteed not to OOM. |
Blind Merge scenarios | Faster than legacy DML (the join is skipped). |
Compatibility
No impact on other features: Hybrid DML and the legacy DML engine are fully isolated. Turning off the GUC parameter reverts to legacy behavior.
No breaking changes: SQL syntax is unchanged and the feature is transparent to applications.
Forward compatible: workloads that ran on earlier versions continue to behave the same way.
Monitoring and troubleshooting
Reading the execution plan
EXPLAIN INSERT INTO target_table
SELECT * FROM source_table
ON CONFLICT (pk) DO UPDATE SET col1 = EXCLUDED.col1;Hybrid DML plan (example):
Insert on target_table
-> DataSetHybridDMLNode -- Hybrid DML operator
Join Strategy: Auto -- Adaptive join
Dedup Action: Throw -- Source-side dedup policy
Memory Quota: 2048 MB -- Memory quota
Runtime Filter: Enabled -- Runtime Filter on
-> Seq Scan on source_tableLegacy DML plan (for comparison):
Insert on target_table
-> DataSetInsertNode -- Legacy Insert operator
-> Hash Left Join -- Fixed join strategy
-> Seq Scan on source_table
-> Seq Scan on target_tableKey differences:
Hybrid DML produces a single-layer operator with the join strategy embedded inside.
Legacy DML uses a standalone Join operator whose strategy is locked in by the optimizer.
Inspect the actual join strategy
Use EXPLAIN (FORMAT PB) to view the detailed Protobuf plan, which includes:
The join strategy actually selected (
join_strategyfield).The source-side deduplication action (
source_deduplicate.actionfield).Runtime Filter settings (
runtime_filter_optionsfield).Memory quota (
memory_quotafield).
Best practices
Day-to-day usage
Keep the defaults: Hologres V3.1 and later enable Hybrid DML by default. Keep
join_modeset toauto; no tuning is required for the vast majority of workloads.Large-table loads need no extra work: you no longer have to estimate data volumes to pick a join strategy.
Dynamic Table workloads: incremental refresh uses Hybrid DML by default; no additional configuration required.
Performance tuning
Scenario | Recommendation |
Large-table load is slow despite sufficient memory | Increase |
Source data is known to contain no duplicates | Set |
All-column update | Make sure the UPDATE SET clause covers every non-primary-key column so that Blind Merge is triggered. |
Fallback procedure
If you run into a Hybrid DML issue, you can revert at any time:
-- Session-level fallback
SET hg_experimental_enable_hybrid_dml = off;
-- Database-level fallback (requires superuser privileges; takes effect for new connections)
ALTER DATABASE dbname SET hg_experimental_enable_hybrid_dml = off;After the fallback, all DML statements run on the legacy DML engine. No SQL changes are required.
Appendix: Full GUC reference
Parameter | Type | Default | Scope | Description |
| bool | on | session / database | Master switch for Hybrid DML. |
| enum | auto | session | Join strategy override. |
| bool | off | session | Whether UPDATE on a primary key column uses Hybrid DML. |
| bool | on | session | Whether to enable Runtime Filter. |
| bool | on | session | Whether the optimizer extracts Hybrid DML filter conditions. |
| int | 70 | 0-100 | CPU time weight in the adaptive cost model. |
| bool | off | session | Disable source-side deduplication. |
| bool | off | session | Blind Merge toggle for ordinary tables. |
| bool | on | session | Use Hybrid DML for Dynamic Table incremental refresh. |