airborne12 opened a new pull request, #70387:
URL: https://github.com/apache/doris/pull/70387

   ### Background
   
   A TopN query publishes its current N-th sort key to all its scanners as one 
runtime filter, a `SharedPredicate`. When a segment is opened, its pages are 
tested against the column predicates through their zone maps.
   
   ### What problem does this PR solve?
   
   Issue Number: None
   Related PR: #70020
   PR Type: Performance
   
   Problem Summary:
   
   That test went through the `SharedPredicate`, which takes a shared lock on 
every page, so the scanners of a query contended on one lock: 15% of BE CPU in 
a search-box TopN over 100M logs. Pages are now tested against a snapshot of 
the bound, as #70020 does between batches.
   
   ### Details
   
   - **Why it was slow:** one rwlock acquisition per page and scanner.
   - **Optimization:** the zone-map predicates of a TopN column are rebuilt 
with the bound its filter holds when the segment is opened; that version counts 
as applied.
   - **Results:** branch-4.2 port, old and new code alternating in one BE: CPU 
per query 4-6% lower, 11-12% once the searched column is fetched after the 
TopN; results identical.
   - **Applicability and cost:** TopN queries with a runtime filter. No change 
to writing or storage.
   
   ### Testing
   
   New BE unit tests in `SegmentIteratorTopNRuntimeFilterTest` (three fail 
before the change), related unit tests, TopN regression suites.
   
   ### Release note
   
   None
   
   ### Check List (For Author)
   
   - Behavior changed: No
   - Does this need documentation: No
   - Pre-submission status: Partially verified: local unit and regression 
tests; CI not run
   
   ### AI Disclosure
   
   - Tool: Claude Code (Claude Opus 5.5)
   - Generated: code, tests, this description
   - Human review: not yet reviewed
   
   🤖 Generated with [Claude Code](https://claude.com/claude-code)
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to