Optimize Data Lake Queries
Reduce external query work by checking partition pruning, scan splitting, remote IO, and cache reuse. Use Query Profile to compare changes on representative queries. The reference defaults below describe Core 26.1.3; session or managed service settings can override them.
Partition pruning
By specifying partition column conditions in queries, unnecessary partitions can be pruned, reducing the amount of data that needs to be read.
You can use EXPLAIN <SQL> to view the partition section of XXX_SCAN_NODE to check whether partition pruning is effective and how many partitions need to be scanned in this query.
For example:
0:VPAIMON_SCAN_NODE(88)
table: paimon_ctl.db.table
predicates: (user_id[#4] = 431304818)
inputSplitNum=15775, totalFileSize=951754154566, scanRanges=15775
partition=203/0
Local data cache
Data Cache accelerates subsequent queries accessing the same data by caching recently accessed data files from remote storage systems (HDFS or object storage) to local disk.
VeloDB Cloud manages local file-cache resources. See Data Cache for cache behavior and the supported controls; do not apply self-managed disk or service-file configuration to a warehouse.
Cache warmup can populate eligible data before an interactive query. See Data Cache for the applicable warehouse workflow and its compute and storage tradeoffs.
Optimize HDFS reads
Please refer to the HDFS IO Optimization section in the HDFS Documentation.
Split count target
When querying external tables (Hive, Iceberg, Paimon, etc.), VeloDB Cloud splits files into multiple splits for parallel processing. In some scenarios, especially when there are a large number of small files, too many splits may be generated, leading to:
- Memory pressure: Too many splits consume a significant amount of FE memory
- OOM issues: Excessive split counts may cause OutOfMemoryError
- Performance degradation: Managing too many splits increases query planning overhead
You can use the max_file_split_num session variable to set a target number of splits per table scan in the legacy, non-batch split-planning path:
- Type:
int - Reference default:
100000 - Description: In non-batch mode, increases the target split size based on the total file size and the requested split count.
Usage example:
-- Set a target split count of 50000
SET max_file_split_num = 50000;
-- Disable target-size adjustment (set to 0 or a negative number)
SET max_file_split_num = 0;
When the value is positive, the planner uses at least ceil(totalFileSize / max_file_split_num) as the target split size. This controls splitting granularity; it is not a hard cap on actual splits, because separate files and indivisible format units can still create additional work. Eligible execution-node refinement uses the controls below.
File Scanner V2
File Scanner V2 is the new execution engine for scanning external table files. It covers the Parquet, ORC, CSV and JSON formats, as well as reads on table formats such as Hive, Iceberg, Paimon and Hudi. It uses different pruning and split-scheduling paths; compare query results, latency, and memory use before changing the session setting.
It is controlled by the enable_file_scanner_v2 session variable:
- Type:
boolean - Reference default:
true - Description: When enabled,
FileScanNodeuses File Scanner V2 for supported query scans. Scenarios such as JDBC Catalog and Iceberg system tables still take the old scan path.
If you suspect that a query issue is related to the new scanner, you can temporarily disable it and compare:
SET enable_file_scanner_v2 = false;
Data pruning behavior
File Scanner V2 always performs safe partition pruning and expression ZoneMap pruning, and is no longer controlled by the session variables below. These two variables only affect the old scanner, which still honors them:
| Variable | Default | Description |
|---|---|---|
enable_runtime_filter_partition_prune | true | Whether to enable Runtime Filter partition pruning. File Scanner V2 always enables safe partition pruning, so setting it to false has no effect on it |
enable_expr_zonemap_filter | false | Whether to enable expression ZoneMap filtering. File Scanner V2 always enables safe expression ZoneMap filtering |
Fine-grained split refinement on execution nodes
When File Scanner V2 is enabled, FE only performs coarse-grained file splitting, and BE further refines each split by Parquet Row Group or ORC Stripe, executing them concurrently within the same scan instance. Adjacent Row Groups / Stripes are merged until they approach the target size.
| Session Variable | Default | Description |
|---|---|---|
file_split_size_on_fe | 536870912 (512MB) | Target size, in bytes, of the coarse-grained file splits produced by FE when BE-side refinement applies |
file_split_size_on_be | 67108864 (64MB) | Target size, in bytes, of the fine-grained file splits produced on BE |
Applicable scope: native Parquet / ORC splits produced by Hive, Iceberg, native Paimon RawFile and file-based table-valued functions, provided that File Scanner V2 is enabled and at least two scanners can consume the generated tasks.
The following scenarios do not apply and fall back to the old FE splitting strategy, which is controlled by file_split_size, max_initial_file_split_size, max_file_split_size and max_file_split_num:
- Formats other than Parquet / ORC;
- File Scanner V2 is disabled;
max_file_scanners_concurrency = 1, or BE uses only one scanner for a small LIMIT query;- Scans on transactional (Full ACID) Hive tables;
- Scans optimized by table-level metadata COUNT;
- Iceberg data files that carry delete files;
- Serialized logical / JNI Paimon splits;
file_split_size_on_feorfile_split_size_on_beis set to a non-positive value.
Tip:
A Row Group or Stripe is the smallest indivisible unit, so the actual size of a single split may exceed the target set by
file_split_size_on_be.
External scan task reuse
When the same external table is referenced several times in one SQL statement (for example a self join, or a CTE referenced more than once), these equivalent scan nodes can reuse the same set of already generated splits, so that FE does not repeat the split planning.
It is controlled by the enable_external_scan_task_reuse session variable:
- Type:
boolean - Reference default:
true - Description: Whether to reuse the splits generated by identical external table scan nodes within the same statement. Applies to Hive, Hudi, Iceberg and Paimon.
Merge IO optimization
For HDFS and object storage, Merge IO combines adjacent reads into a larger request. This can reduce request count while reading additional bytes; compare both IO counters and query latency.
For example, if the original request needs to read parts [0, 10] and [20, 50] of file file1:
Request Range: [0, 10], [20, 50]
Through Merge IO, it will be merged into one request:
Request Range: [0, 50]
In this example, two IO requests are merged into one, but it also reads some additional data (data between 10-20). Therefore, while Merge IO reduces the number of IO operations, it may bring potential read amplification issues.
You can view specific Merge IO information through Query Profile:
- MergedSmallIO:
- MergedBytes: 3.00 GB
- MergedIO: 424
- RequestBytes: 2.50 GB
- RequestIO: 65.555K (65555)
Where RequestBytes and RequestIO indicate the data volume and number of requests in the original request. MergedBytes and MergedIO indicate the data volume and number of requests after merging.
If you find that MergedBytes is much larger than RequestBytes, it indicates serious read amplification. You can adjust it through the following parameters:
-
merge_io_read_slice_size_bytesSession variable with a reference default of
8388608bytes (8 MiB). If you find serious read amplification, you can reduce this parameter, such as to 64KB, and observe whether the modified IO requests and query latency improve.
Parquet page cache
Parquet page cache stores decompressed or compressed Parquet pages in memory for reuse by subsequent queries. It shares the storage page-cache infrastructure; a cache hit can avoid reading and decoding a page again.
Cache behavior
-
Unified Page Cache Integration
- Shares the same underlying
StoragePageCacheframework used by VeloDB Cloud internal tables - Shares memory pool and eviction policies
- Reuses existing cache statistics and RuntimeProfile for unified performance monitoring
- Shares the same underlying
-
Intelligent Caching Strategy
- Compression Ratio Awareness: Automatically decides whether to cache compressed or decompressed data based on the
parquet_page_cache_decompress_thresholdparameter - Flexible Storage Approach: Caches decompressed data when
decompressed size / compressed size ≤ threshold; otherwise, decides whether to cache compressed data based onenable_parquet_cache_compressed_pages - Cache Key Design: Uses
file_path::mtime::offsetas the cache key to ensure cache consistency after file modifications
- Compression Ratio Awareness: Automatically decides whether to cache compressed or decompressed data based on the
Configure the cache
Use the enable_parquet_file_page_cache session variable to control this cache. Its reference default in Core 26.1.3 is true; the managed storage page-cache setting must also permit caching. For example:
SET enable_parquet_file_page_cache = true;
The following backend settings are managed by VeloDB Cloud. Contact VeloDB Cloud support when investigating their effective values or requesting a change. Their compiled defaults are reference values, not observed warehouse settings:
-
parquet_page_cache_decompress_thresholdThreshold that controls whether to cache compressed or decompressed data. Default is
1.5. When the ratio ofdecompressed size / compressed sizeis less than or equal to this threshold, decompressed data will be cached; otherwise, it will decide whether to cache compressed data based on theenable_parquet_cache_compressed_pagessetting. -
enable_parquet_cache_compressed_pagesWhether to cache compressed data pages when the compression ratio exceeds the threshold. Default is
false.
Monitor the cache
You can view Parquet Page Cache usage through Query Profile:
ParquetPageCache:
- PageCacheHitCount: 1024
- PageCacheMissingCount: 128
Where PageCacheHitCount indicates the number of cache hits, and PageCacheMissingCount indicates the number of cache misses.