-
Notifications
You must be signed in to change notification settings - Fork 4.1k
sql/opt: allow plans with routines to be cached #162057
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
base: master
Are you sure you want to change the base?
Conversation
We didn't catch cockroachdb#162055 in our opt tests because they go through the test catalog, while cockroachdb#162055 requires a real catalog to reproduce. This commit adds an execbuilder test to show the query plan caching behavior for different types of prepared statements, including some that contain a reference to a routine. Informs cockroachdb#162055 Release note: None
|
Your pull request contains more than 1000 changes. It is strongly encouraged to split big PRs into smaller chunks. 🦉 Hoot! I am a Blathers, a bot for CockroachDB. My owner is dev-inf. |
|
This was originally just going to add tests, but the fix ended up being pretty simple, so included that too. |
This commit slightly modifies the metadata staleness check so that: * The version is not checked when resolving a routine by name. This is necessary because overloads looked up by name are not fully hydrated and do not have the version set. * All routines are checked against the overload resolved by OID regardless of whether the reference in the query was by name. This lets us do the version check with the correct version. As a result of these changes, the staleness check now correctly identifies when a routine descriptor has not changed since a query plan was cached. Fixes cockroachdb#162055 Release note (performance improvement): Fixed a performance bug that prevented query plans containing user-defined functions from being cached. Repeated executions of prepared statements containing UDFs will now have less planning overhead.
67065bc to
eb1ea9a
Compare
michae2
left a comment
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.
Is it intentional that we're adding all these logictest configs to the exec logictest?
@michae2 reviewed 24 files and all commit messages, and made 1 comment.
Reviewable status:complete! 1 of 0 LGTMs obtained (waiting on @DrewKimball).
sql/opt: add execbuilder test for query caching behavior
We didn't catch #162055 in our opt tests because they go through the
test catalog, while #162055 requires a real catalog to reproduce. This
commit adds an execbuilder test to show the query plan caching behavior
for different types of prepared statements, including some that contain
a reference to a routine.
Informs #162055
Release note: None
sql/opt: allow plans with routines to be cached
This commit slightly modifies the metadata staleness check so that:
necessary because overloads looked up by name are not fully hydrated
and do not have the version set.
of whether the reference in the query was by name. This lets us do the
version check with the correct version.
As a result of these changes, the staleness check now correctly identifies
when a routine descriptor has not changed since a query plan was cached.
Fixes #162055
Release note (performance improvement): Fixed a performance bug that
prevented query plans containing user-defined functions from being
cached. Repeated executions of prepared statements containing UDFs
will now have less planning overhead.