Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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';

Expand Down Expand Up @@ -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);

Copy link
Copy Markdown
Member

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_id no ?

CREATE INDEX IF NOT EXISTS idx_grants_realm_securable
ON grant_records (realm_id, securable_id);

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This one seems already covered by the primary key index.
If we want this index, I think we should include securable_catalog_id, no ?


CREATE TABLE IF NOT EXISTS principal_authentication_data (
realm_id TEXT NOT NULL,
principal_id BIGINT NOT NULL,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it not already covered by idx_entities index ?

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;
Expand Down Expand Up @@ -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,
Expand Down
Loading