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

High-Concurrency Point Queries

What is a high-concurrency point query​

High-concurrency point-query optimizations reduce the work needed to retrieve a row by primary key in VeloDB Cloud. Reading whole rows from wide tables can require multiple column reads, while ordinary query planning adds overhead to these simple key-value lookups.

To address this, VeloDB Cloud applies optimizations at the following layers:

OptimizationProblem solved
Row storeStores columns together to reduce random I/O when reading whole rows of wide tables
Short-circuit query path (SHORT-CIRCUIT)Bypasses parts of ordinary planning and distributed execution for eligible point queries
PreparedStatementReuses cached objects to reduce repeated parsing and expression-processing overhead

Quick enablement checklist​

Before using high-concurrency point queries, confirm that all of the following conditions are met:

  • enable_short_circuit_query is enabled in the session, and the table has no VARIANT columns
  • The table uses the Unique Key model with enable_unique_key_merge_on_write = true enabled
  • store_row_column = true is set at table creation to enable row store
  • light_schema_change = true is enabled at table creation
  • The query contains an equality condition for every key column, and no predicates on value columns, with no joins or nested subqueries
  • If you use JDBC prepared statements, the JDBC URL includes useServerPrepStmts=true.
  • Use EXPLAIN to verify that the execution plan contains the SHORT-CIRCUIT marker

Row store​

Row store mode is used to reduce the random IO overhead when reading whole rows of wide tables. The current implementation encodes a row of data and stores it in a separate column.

  • It can only be enabled at table creation and cannot be modified afterwards.
  • Specify the following property in the PROPERTIES of the CREATE TABLE statement:
"store_row_column" = "true"
  • Enabling row store causes space inflation. If only some columns need to be queried, it is recommended to use row_store_columns to include only the required columns in the row store:
"row_store_columns" = "k1,v1,v2"

Queries only need to access these columns, for example:

SELECT k1, v1, v2 FROM tbl_point_query WHERE k1 = 1;

Point-query optimization under the unique model​

Eligible primary-key point queries on Unique Key tables with merge-on-write and row store enabled can use the short-circuit path, bypassing parts of the ordinary planning and distributed execution flow. The query must also meet the conditions in the quick enablement checklist. In VeloDB Cloud, the snapshot check can require an additional metadata RPC.

Table creation example​

CREATE TABLE `tbl_point_query` (
`k1` int(11) NULL,
`v1` decimal(27, 9) NULL,
`v2` varchar(30) NULL,
`v3` varchar(30) NULL,
`v4` date NULL,
`v5` datetime NULL,
`v6` float NULL,
`v7` datev2 NULL
) ENGINE=OLAP
UNIQUE KEY(`k1`)
COMMENT 'OLAP'
DISTRIBUTED BY HASH(`k1`) BUCKETS 1
PROPERTIES (
"enable_unique_key_merge_on_write" = "true",
"light_schema_change" = "true",
"store_row_column" = "true"
);

Key constraints and notes​

Constraint / PropertyDescription
enable_unique_key_merge_on_writeMust be enabled. The storage engine relies on this property for fast primary-key point queries
light_schema_changeMust be enabled. Primary-key point queries depend on its column unique id to locate columns
Query conditionsOnly single-table equality queries that constrain every key column are supported. Joins and nested subqueries are not supported
Predicate formThe WHERE clause must contain only equality conditions on Key columns, which can be regarded as a KV-style query
Row store spaceEnabling row store causes space inflation. It is recommended to use row_store_columns to specify a subset of columns

For the example’s one-column key, SELECT * FROM tbl_point_query WHERE k1 = 123 meets the key-predicate requirement. Use EXPLAIN to check whether the whole plan is eligible.

Use PreparedStatement​

To reduce the overhead of SQL parsing and expression evaluation, VeloDB Cloud provides a PreparedStatement feature on the FE side that is compatible with the MySQL prepared-statement protocol for supported point queries.

  • Once enabled, SQL and expressions are computed in advance and cached in a session-level memory cache.
  • Subsequent queries reuse the cached objects directly, avoiding repeated parsing and computation.
  • The upstream guide reports a performance improvement of more than 4x for a CPU-bound primary-key workload. It does not provide a reproducible environment or complete workload settings. This is not a VeloDB Cloud measurement or expected speedup. Benchmark your own workload.

Step 1: Enable server-side PreparedStatement in the JDBC URL​

Replace <warehouse-host>, <mysql-port>, and <database-name> with the warehouse connection details and database. Configure your JDBC trust store for the warehouse certificate.

jdbc:mysql://<warehouse-host>:<mysql-port>/<database-name>?useServerPrepStmts=true&sslMode=VERIFY_IDENTITY

Step 2: Use PreparedStatement in code​

// Use ? as a parameter placeholder and reuse readStatement.
PreparedStatement readStatement = conn.prepareStatement("select * from tbl_point_query where k1 = ?");
...
readStatement.setInt(1, 1234);
ResultSet resultSet = readStatement.executeQuery();
...
readStatement.setInt(1, 1235);
resultSet = readStatement.executeQuery();
...

Performance tuning recommendations​

After the capabilities above are enabled, you can further improve point-query throughput and stability based on your deployment architecture:

  1. Reuse prepared statements and connections to reduce repeated parsing and connection overhead.
  2. Use the warehouse connection endpoint rather than addressing individual frontend nodes.
  3. If frontend CPU remains the bottleneck, provide workload concurrency, latency, and query examples to VeloDB Cloud support for a service-capacity review. Frontend node roles and routing are managed by the service.

FAQs​

Q1: How can I confirm that the configuration is correct and that high-concurrency point queries use the short-circuit optimization?​

The following upstream output is illustrative and is not a measured VeloDB Cloud execution. Run EXPLAIN. If SHORT-CIRCUIT appears in the execution plan, the short-circuit optimization is in use:

mysql> explain select * from tbl_point_query where k1 = -2147481418 ;
+-----------------------------------------------------------------------------------------------+
| Explain String(Old Planner) |
+-----------------------------------------------------------------------------------------------+
| PLAN FRAGMENT 0 |
| OUTPUT EXPRS: |
| `test`.`tbl_point_query`.`k1` |
| `test`.`tbl_point_query`.`v1` |
| `test`.`tbl_point_query`.`v2` |
| `test`.`tbl_point_query`.`v3` |
| `test`.`tbl_point_query`.`v4` |
| `test`.`tbl_point_query`.`v5` |
| `test`.`tbl_point_query`.`v6` |
| `test`.`tbl_point_query`.`v7` |
| PARTITION: UNPARTITIONED |
| |
| HAS_COLO_PLAN_NODE: false |
| |
| VRESULT SINK |
| MYSQL_PROTOCAL |
| |
| 0:VOlapScanNode |
| TABLE: test.tbl_point_query(tbl_point_query), PREAGGREGATION: ON |
| PREDICATES: `k1` = -2147481418 AND `test`.`tbl_point_query`.`__DORIS_DELETE_SIGN__` = 0 |
| partitions=1/1 (tbl_point_query), tablets=1/1, tabletList=360065 |
| cardinality=9452868, avgRowSize=833.31323, numNodes=1 |
| pushAggOp=NONE |
| SHORT-CIRCUIT |
+-----------------------------------------------------------------------------------------------+

Q2: How can I confirm that PreparedStatement is in effect?​

Confirm useServerPrepStmts=true, reuse the same JDBC PreparedStatement, and check the driver’s prepared-statement diagnostics. If server-side confirmation is needed, provide the query time and connection details to VeloDB Cloud support. Direct access to frontend host logs is a managed-service operation.

Q3: Can non-primary-key queries use the special high-concurrency point-query optimization?​

No. The short-circuit optimization requires equality conditions on every key column, with no predicates on value columns, joins, or nested subqueries. The other conditions in the quick enablement checklist also apply.

Q4: Is useServerPrepStmts useful for ordinary queries?​

PreparedStatement currently takes effect only for primary-key point queries.

Q5: Do I need to set the optimizer choice globally?​

No. When using PreparedStatement for queries, the query engine selects an eligible execution path, with no need to set the optimizer manually.

Q6: What should I do when the FE becomes the bottleneck?​

Reuse server-side prepared statements and client-side statement objects. The following JDBC options can reduce repeated preparation:

useServerPrepStmts=true&cachePrepStmts=true&prepStmtCacheSize=500&prepStmtCacheSqlLimit=1024

Use them with the warehouse connection URL, and benchmark the cache sizes for your application. Contact VeloDB Cloud support if frontend CPU remains high. Do not add or target individual frontend nodes yourself.

Q7: How can I optimize query performance under the storage-compute separation deployment?​

Consider the following options:

  • Test disabling snapshot point queries: Only run this experiment if your application accepts older committed data. First record the session's original setting:

    SHOW VARIABLES LIKE 'enable_snapshot_point_query';

    Then disable snapshot point queries for the session:

    SET enable_snapshot_point_query = false;

    Fetching the version from Meta Service adds a metadata RPC that can become a bottleneck at high query rates. Setting enable_snapshot_point_query to false uses a cached version and can return older committed data. Compare latency and data visibility, then restore the original session value. A latency improvement is workload-dependent.

  • Enable Base Compaction output cache: Ask VeloDB Cloud support to review the managed backend setting enable_file_cache_keep_base_compaction_output so that the result data after Base Compaction is placed into the cache, avoiding query jitter caused by remote access.