Skip to main content
VeloDB Cloud 26.x is based on Apache Doris 4.x. See Version Mapping.

Tune DML Plans

Check the prerequisites​

Before starting DML plan tuning, confirm the following:

  • Whether you can clearly distinguish the time spent in the load phase from the time spent in the query phase.
  • Whether you have reviewed the Profile / Query Plan to identify the operator or phase with the longest runtime.
  • Whether you have read the Load Overview to understand the load methods that fit your scenarios.

Identify the slow phase​

The performance bottleneck of a DML statement (such as INSERT INTO ... SELECT) usually comes from two sources. The first step is to identify which phase the bottleneck is in, then tune accordingly.

Bottleneck TypeTypical SymptomsTuning Entry Point
Load-phase bottleneckLow write throughput, high time spent on Sink operatorsSee the Load Overview to choose an appropriate load method and best practices
Query-phase bottleneckHigh time spent on operators such as Scan, Join, and aggregationSee other sections in Plan Tuning for diagnosis and tuning

Tune the write phase​

Choose a load method for the source, data volume, and freshness requirements. For INSERT INTO ... SELECT, inspect sink time, rows written, and load status alongside scan and join operators.

  • Goal: Choose a suitable load method based on the data source and timeliness requirements to improve overall DML performance.
  • Entry point: Load Overview.
  • Note: Load methods include Stream Load, Broker Load, Routine Load, INSERT, and others. See the link above for best practices in detail.

Tune the query phase​

If the bottleneck is in the query phase, follow the other sections of plan tuning to diagnose and optimize, for example, table schema optimization, statistics, join order, and operator rewriting. See Plan Tuning for details.

FAQ​

Q1: How can I quickly tell whether the slowness of a DML statement is in the load phase or the query phase? Compare scan, join, aggregation, and sink activity in the query profile. Long sink time can include waiting for upstream data, so confirm the diagnosis with row counts, write throughput, and load status rather than adding operator times together.

Q2: When INSERT INTO ... SELECT is slow, which part should I look at first? Inspect the complete DML profile first. Running the SELECT alone can help isolate query work, but result transfer, cache state, and the plan can differ from the DML statement. Use it as a comparison, then confirm with the sink and load metrics.

Q3: Do all load methods need to be tuned the same way? No. Different load methods (Stream Load, Broker Load, Routine Load, INSERT, and others) require different tuning approaches. See the Load Overview.