Skip to content

Conversation

hazefully
Copy link
Contributor

@hazefully hazefully commented Oct 16, 2025

This PR improves the rewriting cost model by making it consider the number of predicates in each expression at each level of the expression graph, instead of just looking at the lowest expression with no predicates at all. This is in order for the cost model to prefer queries with the same number of predicates, where some predicates were pushed from higher levels in the QGM to lower levels, which can lead to better index matching in the planning phase.

Example: the cost model should prefer the logical plan SELECT a FROM (SELECT a, b FROM T WHERE a = 42) WHERE EXISTS (SELECT a FROM T2) over SELECT a FROM (SELECT a, b, d FROM T) WHERE a = 42 AND EXISTS (SELECT a FROM T2).

@hazefully hazefully requested a review from normen662 October 16, 2025 14:57
@hazefully hazefully added the enhancement New feature or request label Oct 16, 2025
@hazefully hazefully force-pushed the improve-rewriting-cost-model branch from 3b65482 to 65694f8 Compare October 16, 2025 15:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant