-
Notifications
You must be signed in to change notification settings - Fork 409
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Speed up introspection of system objects like Database and Role (#6665)
Currently if there are a lot of roles, doing a query like `select sys::Role { member_of }` is quite slow. This is because the views for both `Role` and `member_of` need to extract metadata for *every* Role and pase it as json, and postgres is planning this as a nested loop. Unfortunately, startup needs to query all these objects, so having lots of databases or roles is a problem. Fix this by forcing sys objects and links to always be materialized into CTEs. This ensures that we do at most one linear scan of each of the views. Since there is no way to hit an index when querying any of these system object views, always doing a linear scan is no worse. For the objects themselves we can leverage the rewrites mechanism. For link tables, we add a slightly lighter weight mechanism to handle it. Reverts the now-unnecessary main part of #6633 but keeps the extension to the patch system. We could actually put annotations on databases now and have it not be *too* slow. This can be backported with an empty `edgeql+schema+globalonly` patch.
- Loading branch information
1 parent
490d460
commit 95c4f05
Showing
5 changed files
with
79 additions
and
23 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters