You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@asterixdb.apache.org by AsterixDB Code Review <do...@asterix-gerrit.ics.uci.edu> on 2026/10/07 09:37:15 UTC
[M] Change in asterixdb[master]: [NO ISSUE][COMP] Fix CBO cost of a pushed LIMIT
From Rithwik Koul <ri...@couchbase.com>:
Attention is currently required from: Rithwik Koul.
Hello Jenkins,
I'd like you to reexamine a change. Please visit
https://asterix-gerrit.ics.uci.edu/c/asterixdb/+/22002?usp=email
to look at the new patch set (#4).
Change subject: [NO ISSUE][COMP] Fix CBO cost of a pushed LIMIT
......................................................................
[NO ISSUE][COMP] Fix CBO cost of a pushed LIMIT
The CBO costed every operator of a plan as if it stopped at a pushed
LIMIT. A limit is pushed only into a primary-index search, so a
secondary-index search still returns every match, and the primary-key
sort after it is blocking. An index plan therefore looked near-constant
and won even when a scan that stops after a few rows was far cheaper.
A pushed limit also stops each partition on its own, and the input has
to produce the offset rows too, since the LIMIT skips them itself. The
costed limit ignored both, and passed through operators that consume
their whole input.
A primary-index search returns the records itself, so it is no longer
charged a primary-key sort and fetch.
Ext-ref: MB-70486
Generated-by: Claude Opus 5.5 <no...@anthropic.com>
Change-Id: Id437d35c7c3e3f9624076464d196518da823400c
---
M asterixdb/asterix-algebra/src/main/java/org/apache/asterix/optimizer/cost/CostMethods.java
M asterixdb/asterix-algebra/src/main/java/org/apache/asterix/optimizer/cost/ICostMethods.java
M asterixdb/asterix-algebra/src/main/java/org/apache/asterix/optimizer/rules/PushLimitIntoOrderByRule.java
M asterixdb/asterix-algebra/src/main/java/org/apache/asterix/optimizer/rules/cbo/JoinEnum.java
M asterixdb/asterix-algebra/src/main/java/org/apache/asterix/optimizer/rules/cbo/JoinNode.java
M asterixdb/asterix-app/src/test/resources/runtimets/results_cbo/limit/push-limit-to-primary-lookup-select/push-limit-to-primary-lookup-select.3.plan
6 files changed, 107 insertions(+), 74 deletions(-)
git pull ssh://asterix-gerrit.ics.uci.edu:29418/asterixdb refs/changes/02/22002/4
--
To view, visit https://asterix-gerrit.ics.uci.edu/c/asterixdb/+/22002?usp=email
To unsubscribe, or for help writing mail filters, visit https://asterix-gerrit.ics.uci.edu/settings?usp=email
Gerrit-MessageType: newpatchset
Gerrit-Project: asterixdb
Gerrit-Branch: master
Gerrit-Change-Id: Id437d35c7c3e3f9624076464d196518da823400c
Gerrit-Change-Number: 22002
Gerrit-PatchSet: 4
Gerrit-Owner: Rithwik Koul <ri...@couchbase.com>
Gerrit-Reviewer: Jenkins <je...@fulliautomatix.ics.uci.edu>
Gerrit-Attention: Rithwik Koul <ri...@couchbase.com>