Skip to content

chore(db): Drop unsed index on key column in Commit table #91610

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

Merged
merged 1 commit into from
May 14, 2025

Conversation

vgrozdanic
Copy link
Member

@vgrozdanic vgrozdanic commented May 14, 2025

This index was last used on Oct 29th, and it consumes almost 100gb in our main SaaS DB, so there is no reason to keep it.

I went through our codebase and couldn't find any query that would still be using this index. On our main US DB this should probably be executed by an SRE, since dropping the index could timeout, even as a post deployment migration. In other regions, index size is small enough to be run as a regular post deployment migration job.

@vgrozdanic vgrozdanic requested a review from beezz May 14, 2025 08:34
@vgrozdanic vgrozdanic requested a review from a team as a code owner May 14, 2025 08:34
@github-actions github-actions bot added the Scope: Backend Automatically applied to PRs that change backend components label May 14, 2025
Copy link
Contributor

This PR has a migration; here is the generated SQL for src/sentry/migrations/0889_remove_index_on_key_field.py

for 0889_remove_index_on_key_field in sentry

--
-- Alter field key on commit
--
DROP INDEX CONCURRENTLY IF EXISTS "sentry_commit_key_a5b0367e";
DROP INDEX CONCURRENTLY IF EXISTS "sentry_commit_key_a5b0367e_like";

@vgrozdanic vgrozdanic merged commit 91d422e into master May 14, 2025
63 checks passed
@vgrozdanic vgrozdanic deleted the vgrozdanic/drop-index-on-commit-key branch May 14, 2025 09:11
vgrozdanic added a commit that referenced this pull request May 14, 2025
…#91611)

Similar as in #91610, index on
`last_seen` column hasn't been used since Oct 29th (since then we track
the usage), and it takes 674GiB of disk in our main US DB.

I went through our codebase and couldn't find any query that would still
be using this index. On our main US DB (and some other single tenants)
this will be executed by an SRE, since dropping the index will likely
timeout, even as a post deployment migration. For other regions, this
index is small enough to be removed as a post deployment migration
@wedamija
Copy link
Member

fwiw - dropping an index concurrently should be fast

@github-actions github-actions bot locked and limited conversation to collaborators May 30, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Scope: Backend Automatically applied to PRs that change backend components
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants