-
Notifications
You must be signed in to change notification settings - Fork 3.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
opt: add helper functions for partial indexes and scans #51232
Conversation
This commit adds helper functions to determine if indexes are partial indexes, if scans operate on partial indexes, and for retrieving partial index predicate expressions. Within the optimizer `TableMeta.PartialIndexPredicates` is now the source of truth that should be used for answering these types of questions. The catalog `Index.Predicate` function should only be used by the optbuilder. This commit also makes certain that there is an entry in the `TableMeta.PartialIndexPredicates` map for every partial index on the table, even if the partial index predicate is non-immutable. This makes the map a safe source of truth for determining which indexes are partial. Release note: None
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewable status: complete! 1 of 0 LGTMs obtained (waiting on @mgartner)
pkg/sql/opt/memo/expr.go, line 812 at r1 (raw file):
} // IsPartialIndex returns true if the table's index at the given ordinal is
[nit] should these be methods of TableMeta?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewable status: complete! 1 of 0 LGTMs obtained (waiting on @RaduBerinde)
pkg/sql/opt/memo/expr.go, line 812 at r1 (raw file):
Previously, RaduBerinde wrote…
[nit] should these be methods of TableMeta?
IsPartialIndex
could be, but PartialIndexPredicate
cannot because it returns a memo.FiltersExpr
, and the memo
package can't be used from the opt
package. I wanted this function to do the type cast rather than have each caller do the cast. And I think it's best to keep both of these functions together rather than put one in TableMeta and one here.
bors r=RaduBerinde |
pkg/sql/opt/memo/expr.go, line 812 at r1 (raw file): Previously, mgartner (Marcus Gartner) wrote…
👍 |
Build succeeded |
This commit adds helper functions to determine if indexes are partial
indexes, if scans operate on partial indexes, and for retrieving partial
index predicate expressions.
Within the optimizer
TableMeta.PartialIndexPredicates
is now thesource of truth that should be used for answering these types of
questions. The catalog
Index.Predicate
function should only be used bythe optbuilder.
This commit also makes certain that there is an entry in the
TableMeta.PartialIndexPredicates
map for every partial index on thetable, even if the partial index predicate is non-immutable. This makes
the map a safe source of truth for determining which indexes are
partial.
Release note: None