Data Export Best Practices
Tune export concurrency by measuring completed runs and comparing their impact on other warehouse workloads. More parallel writers can increase throughput, but they also consume compute, create more files, and increase destination requests. This guide covers two methods:
| Export Method | Applicable Scenarios | Concurrency Control |
|---|---|---|
SELECT INTO OUTFILE | Exporting the result of a single SQL query, flexible and customizable | enable_parallel_outfile session variable |
EXPORT | Bulk export of large tables or partitions, automatically split into multiple Outfile tasks | parallelism, data_consistency, and others |
Tune SELECT INTO OUTFILE
SELECT INTO OUTFILE can write data through multiple parallel writers. Its result rows describe the output writers for that statement. Use the returned information to inspect actual output concurrency rather than calculating it from the cluster size alone.
Enable parallel export
Purpose: Increase the concurrency of SELECT INTO OUTFILE.
How to judge: The number of rows returned by SELECT INTO OUTFILE represents the number of parallel writers. If only 1 row is returned (a single writer), you can try enabling parallel export.
Command:
SET enable_parallel_outfile = true;
Check query parallelism:
-
enable_parallel_outfileenables parallel output where the query plan permits it. Its engine default in Core 26.1.3 isfalse. -
parallel_pipeline_task_numcontrols pipeline task parallelism. Its engine default is0, which selects parallelism automatically from the selected cluster's executor capacity, subject to user settings and a maximum. This is not a fixed writer-count formula. Inspect the current session value:SHOW VARIABLES LIKE 'parallel_pipeline_task_num'; -
Global gather operators, such as a final sort or aggregation, can constrain output concurrency. Enabling parallel output does not guarantee a fixed number of writers.
-
Compare elapsed time, file count, destination throughput, and the impact on concurrent queries before increasing parallelism further.
Evaluate export speed
Purpose: Find whether writing is the bottleneck, or whether query execution and destination behavior dominate the elapsed time.
Steps:
- Look at the write time (in seconds) and speed (in KB/s) of each writer in the rows returned by
SELECT INTO OUTFILE. - Compare writer speeds with total elapsed time, query execution time, and destination storage metrics. writer intervals can overlap or differ, so their sum is only an estimate of aggregate throughput.
- Check warehouse CPU, memory, and network metrics alongside destination throttling and request limits. Warehouse users do not need access to service-host disks or network interfaces.
Low throughput alone does not prove that concurrency is too low. A slow scan, expensive query operators, network latency, or destination throttling can limit export speed. Change one setting at a time and measure again.
Tune EXPORT
The EXPORT command essentially splits one export job into multiple SELECT INTO OUTFILE statements for execution. Understanding this splitting model is the prerequisite for tuning.
Inspect execution through the returned result
Command:
SHOW EXPORT;
The OutfileInfo column contains a JSON string structured as a two-dimensional array:
- First dimension: The output groups for the
OUTFILEstatements generated by the job. This is not a measurement of how many statements ran at the same instant. - Second dimension: The return value of a single Outfile statement (the write details of multiple writers).
Example:
The following OutfileInfo value illustrates two OUTFILE statements with four writers each. The values are examples, not measured Cloud results.
[
[
{
"fileNumber": "1",
"totalRows": "640000",
"fileSize": "350000000",
"url": "s3://<bucket>/export/run-0/part-0_*",
"writeTime": "18.0",
"writeSpeed": "18988.72"
},
{
"fileNumber": "1",
"totalRows": "640001",
"fileSize": "350000000",
"url": "s3://<bucket>/export/run-0/part-1_*",
"writeTime": "18.0",
"writeSpeed": "18988.72"
},
{
"fileNumber": "1",
"totalRows": "640002",
"fileSize": "350000000",
"url": "s3://<bucket>/export/run-0/part-2_*",
"writeTime": "18.0",
"writeSpeed": "18988.72"
},
{
"fileNumber": "1",
"totalRows": "640003",
"fileSize": "350000000",
"url": "s3://<bucket>/export/run-0/part-3_*",
"writeTime": "18.0",
"writeSpeed": "18988.72"
}
],
[
{
"fileNumber": "1",
"totalRows": "641000",
"fileSize": "350000000",
"url": "s3://<bucket>/export/run-1/part-0_*",
"writeTime": "18.0",
"writeSpeed": "18988.72"
},
{
"fileNumber": "1",
"totalRows": "641001",
"fileSize": "350000000",
"url": "s3://<bucket>/export/run-1/part-1_*",
"writeTime": "18.0",
"writeSpeed": "18988.72"
},
{
"fileNumber": "1",
"totalRows": "641002",
"fileSize": "350000000",
"url": "s3://<bucket>/export/run-1/part-2_*",
"writeTime": "18.0",
"writeSpeed": "18988.72"
},
{
"fileNumber": "1",
"totalRows": "641003",
"fileSize": "350000000",
"url": "s3://<bucket>/export/run-1/part-3_*",
"writeTime": "18.0",
"writeSpeed": "18988.72"
}
]
]
Control job parallelism: Use parallelism in the EXPORT properties to set the requested maximum number of OUTFILE tasks for an internal-table job. The actual task count also depends on partitions or tablets, and scheduling determines how many execute at once. Views and external tables use one OUTFILE statement per job.
Parameters that affect parallelism
The overall parallelism of an EXPORT job is jointly determined by the following parameters:
| Parameter | Scope | Default | Description |
|---|---|---|---|
parallelism | EXPORT command | 1 (source default) | Controls the maximum number of OUTFILE statements an EXPORT job can be split into |
data_consistency | EXPORT command | partition (source default) | Controls whether to further split OUTFILE statements within a partition |
async_task_consumer_thread_num | Managed FE configuration | 64 (source default) | Scheduler worker setting shared by tasks on that frontend. Confirm the deployed value with support. |
parallelism
Controls the maximum number of OUTFILE statements a single EXPORT job can be split into, that is, the upper limit of concurrency within the job.
data_consistency
Controls whether to further split OUTFILE statements within a partition:
partition(default): Does not split partitions further. The number ofOUTFILEstatements is less than or equal to the number of partitions involved.none: Splits partitions further to increase concurrency. If writes occur during export, different statements can read different versions, and a detected version change can cause the export to fail. Pause writes when the workflow requires stable results. Neither mode guarantees a single snapshot across all exported partitions.
For details, see the EXPORT command manual.
async_task_consumer_thread_num
This is a service-managed scheduler setting, not a warehouse SQL session variable. The compiled default is 64, but it does not establish your warehouse's effective capacity or a warehouse-wide concurrency guarantee. If jobs remain queued after query-level tuning, contact VeloDB Cloud support. Warehouse users do not edit fe.conf or restart frontends.
Tune an export workload
When export performance does not meet expectations, follow the order below to investigate:
- Inspect output writers: Use the rows returned by
SELECT INTO OUTFILEor theOutfileInfogroups inSHOW EXPORTto inspect writer output. These results do not establish simultaneous task execution across the job. - Evaluate throughput: Compare elapsed time and output sizes with warehouse metrics and destination metrics. Identify query or write bottlenecks before adding concurrency.
- Adjust concurrency parameters:
SELECT INTO OUTFILE: Enableenable_parallel_outfileand, if necessary, adjustparallel_pipeline_task_num.EXPORT: Adjustparallelism. Usedata_consistency=noneonly when the workflow can tolerate its consistency and failure tradeoffs.
- Investigate persistent queueing: If session and job tuning do not help, contact VeloDB Cloud support with the job status and timing information.
- Verify and clean up: Check exported data before consuming it. Remove obsolete output with your storage tools. Include storage, request, network, and warehouse compute charges when evaluating a tuning run.