Skip to content

Conversation

@sg-gs
Copy link
Member

@sg-gs sg-gs commented Jan 8, 2026

What

Removing unused indexes on the files table.

Why

To improve the files table performance.

How

Leveraging Postgres mechanisms to get context about the current indexes usage. (pg_stat_user_indexes). Executed this:

SELECT
  schemaname,
  relname AS tabla,
  indexrelname AS indice,
  idx_scan, pg_size_pretty(pg_relation_size(indexrelid)) AS size
FROM pg_stat_user_indexes
where relname = 'files'
ORDER BY idx_scan asc, size asc;

Got something like this:

schema_name tabla	indice                                              idx_scan   size
public	          files	files_modification_time_index	0	          13.8 GB
....

Checked on the codebase. No filter involving the modification_time field is being used.

@sg-gs sg-gs self-assigned this Jan 8, 2026
@sg-gs sg-gs requested a review from jzunigax2 as a code owner January 8, 2026 12:06
@sg-gs sg-gs added the enhancement New feature or request label Jan 8, 2026
@sg-gs
Copy link
Member Author

sg-gs commented Jan 8, 2026

Migration already run @jzunigax2

@sonarqubecloud
Copy link

sonarqubecloud bot commented Jan 8, 2026

@sg-gs sg-gs merged commit 9af2763 into master Jan 8, 2026
13 checks passed
@sg-gs sg-gs deleted the fix/remove-unused-indexes branch January 8, 2026 13:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request ready-for-preview

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants