Skip to content

2.27.0.0-b601

@spolitov spolitov tagged this 24 Sep 14:21
Summary:
The `HybridScanChoices` class optimizes row scanning by generating seek keys to bypass non-qualifying rows.
These keys may be key prefixes that may not exist in the database and may cover a range of rows (e.g., a seek to (k1=10) can match many rows where the first key column is 10).
When the iterator has moved past all rows matching the current seek prefix, the scan choices logic must determine the next prefix to seek to.
To do this, scan choices needs to understand the logical parts of the current prefix.
Previously, these parts were inferred by decoding the active seek prefix from its raw byte representation on each iteration.
This re-parsing was a costly performance bottleneck.
This commit introduces a `ScanTarget` class that encapsulates the seek prefix and its logical structure, removing the need for repeated, expensive decoding.

The refactoring in `HybridScanChoices` was done to address this issue.
The list of changes:
1) Introduce `ScanTarget` class that encapsulates used options state.
2) Updated `RangeOption` class to handle scenario when option is a single point to avoid superfluous comparison.
3) Fixed logic with handling group end mark in generated key. So group end mark is added only after hash and range key groups.

Performance comparison using PgSingleTServerTest.ScanWithChoices test against master (52d69676f7083f0cada72c8c97b3ba2c580d8961) using release build (no lto):
Full read time for master: 0.80s
This diff: 0.63s, i.e. 21% improvement.
Jira: DB-18299

Test Plan: PgSingleTServerProcess.ScanWithChoices

Reviewers: patnaik.balivada

Reviewed By: patnaik.balivada

Subscribers: ybase, yql

Tags: #jenkins-ready

Differential Revision: https://phorge.dev.yugabyte.com/D46699
Assets 2
Loading