-
Notifications
You must be signed in to change notification settings - Fork 541
fix(schema): Add critical performance indexes to resolve create_namespace latency >30s #3939
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -62,6 +62,7 @@ CREATE INDEX IF NOT EXISTS idx_locations ON entities(realm_id, catalog_id, locat | |
|
|
||
| -- TODO: create indexes based on all query pattern. | ||
| CREATE INDEX IF NOT EXISTS idx_entities ON entities (realm_id, catalog_id, id); | ||
| CREATE INDEX IF NOT EXISTS idx_entities_catalog_id_id ON entities (catalog_id, id); | ||
|
|
||
| COMMENT ON TABLE entities IS 'all the entities'; | ||
|
|
||
|
|
@@ -97,6 +98,11 @@ COMMENT ON COLUMN grant_records.grantee_catalog_id IS 'catalog id of the grantee | |
| COMMENT ON COLUMN grant_records.grantee_id IS 'id of the grantee'; | ||
| COMMENT ON COLUMN grant_records.privilege_code IS 'privilege code'; | ||
|
|
||
| CREATE INDEX IF NOT EXISTS idx_grants_realm_grantee | ||
| ON grant_records (realm_id, grantee_id); | ||
| CREATE INDEX IF NOT EXISTS idx_grants_realm_securable | ||
| ON grant_records (realm_id, securable_id); | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This one seems already covered by the primary key index. |
||
|
|
||
| CREATE TABLE IF NOT EXISTS principal_authentication_data ( | ||
| realm_id TEXT NOT NULL, | ||
| principal_id BIGINT NOT NULL, | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -57,6 +57,7 @@ CREATE TABLE IF NOT EXISTS entities ( | |
|
|
||
| -- TODO: create indexes based on all query pattern. | ||
| CREATE INDEX IF NOT EXISTS idx_entities ON entities (realm_id, catalog_id, id); | ||
| CREATE INDEX IF NOT EXISTS idx_entities_catalog_id_id ON entities (catalog_id, id); | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is it not already covered by |
||
| CREATE INDEX IF NOT EXISTS idx_locations | ||
| ON entities USING btree (realm_id, parent_id, location_without_scheme) | ||
| WHERE location_without_scheme IS NOT NULL; | ||
|
|
@@ -97,6 +98,11 @@ COMMENT ON COLUMN grant_records.grantee_catalog_id IS 'catalog id of the grantee | |
| COMMENT ON COLUMN grant_records.grantee_id IS 'id of the grantee'; | ||
| COMMENT ON COLUMN grant_records.privilege_code IS 'privilege code'; | ||
|
|
||
| CREATE INDEX IF NOT EXISTS idx_grants_realm_grantee | ||
| ON grant_records (realm_id, grantee_id); | ||
| CREATE INDEX IF NOT EXISTS idx_grants_realm_securable | ||
| ON grant_records (realm_id, securable_id); | ||
|
|
||
| CREATE TABLE IF NOT EXISTS principal_authentication_data ( | ||
| realm_id TEXT NOT NULL, | ||
| principal_id BIGINT NOT NULL, | ||
|
|
||
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.
The index should include
grantee_catalog_idno ?