-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Open
Labels
EnhancementEnhance existing functionalityEnhance existing functionalityPerformancePerformance improvementsPerformance improvementsSQLIssues or changes relating to SQL executionIssues or changes relating to SQL execution
Description
Problem
When closing async record cursors (e.g., AsyncWindowJoinRecordCursor, AsyncFilteredRecordCursor, AsyncGroupByRecordCursor), the current implementation reduces/executes all published tasks before completing the cleanup. This is wasteful because these task results will be discarded anyway.
Current behavior
- On
close(), the cursor callscollectCursor(true)andframeSequence.await() - This causes remaining tasks in the frame sequence to be reduced (executed) by workers
- The results are then discarded since the cursor is closing
Suggested enhancement
When closing a cursor, skip all tasks that belong to the frame sequence being closed instead of reducing them. This would:
- Avoid wasting CPU cycles on work that will be discarded
- Reduce query latency, especially for queries with
LIMIT nthat close early
Additional context
The SIGSEGV bug in #6662 manifested reliably with LIMIT n clauses because the query owner thread (when not a worker thread) was guaranteed to reduce remaining tasks during close, which accelerated the race condition between task reduction and resource cleanup.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
EnhancementEnhance existing functionalityEnhance existing functionalityPerformancePerformance improvementsPerformance improvementsSQLIssues or changes relating to SQL executionIssues or changes relating to SQL execution