Skip to content
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

infra/models: review table indices #1500

Open
slint opened this issue Sep 26, 2023 · 2 comments
Open

infra/models: review table indices #1500

slint opened this issue Sep 26, 2023 · 2 comments
Labels
enhancement New feature or request stale

Comments

@slint
Copy link
Member

slint commented Sep 26, 2023

From running https://github.com/ankane/dexter on a local PostgreSQL instance, the following table indices were recommended:

CREATE INDEX IF NOT EXISTS idx_accounts_user_displayname ON accounts_user USING btree (displayname);
CREATE INDEX IF NOT EXISTS idx_communities_members_group_id ON communities_members USING btree (group_id);
CREATE INDEX IF NOT EXISTS idx_communities_members_user_id ON communities_members USING btree (user_id);
CREATE INDEX IF NOT EXISTS idx_communities_metadata_bucket_id ON communities_metadata USING btree (bucket_id);
CREATE INDEX IF NOT EXISTS idx_files_files_last_check ON files_files USING btree (last_check);
CREATE INDEX IF NOT EXISTS idx_pidstore_pid_pid_value ON pidstore_pid USING btree (pid_value);
CREATE INDEX IF NOT EXISTS idx_rdm_parents_community_request_id ON rdm_parents_community USING btree (request_id);
CREATE INDEX IF NOT EXISTS idx_rdm_records_files_record_id ON rdm_records_files USING btree (record_id);
CREATE INDEX IF NOT EXISTS idx_rdm_records_metadata_bucket_id ON rdm_records_metadata USING btree (bucket_id);
CREATE INDEX IF NOT EXISTS idx_rdm_versions_state_next_draft_id ON rdm_versions_state USING btree (next_draft_id);

This means that in some cases we're performing inefficient SQL queries, missing out on indexed columns (a prime example would be the idx_pidstore_pid_pid_value index on pidstore_pid.pid_value). Most of the statistics collected during record bulk indexing to search, but in general we should try to profile SQL queries and review our tables.

Copy link
Contributor

This issue was automatically marked as stale.

@github-actions github-actions bot added the stale label Nov 26, 2023
@slint slint removed the stale label Nov 27, 2023
Copy link
Contributor

This issue was automatically marked as stale.

@github-actions github-actions bot added the stale label Jan 27, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request stale
Projects
None yet
Development

No branches or pull requests

1 participant