Skip to content

Conversation

@pinglin
Copy link
Member

@pinglin pinglin commented Feb 2, 2026

Because

  • Slow SQL queries (200-400ms) observed in artifact-backend pod when uploading many files simultaneously
  • The query SELECT ... FROM object WHERE uid = '...' AND delete_time IS NULL doesn't have an optimal index
  • While uid is the primary key, adding delete_time IS NULL forces PostgreSQL to do a filter step after the index scan
  • Under high concurrency, this causes significant performance degradation

This commit

  • Adds migration 000058 with a partial index idx_object_uid_not_deleted on object(uid) WHERE delete_time IS NULL
  • This allows the query planner to use a direct index lookup without filtering, significantly improving query performance under concurrent load
  • Updates TargetSchemaVersion from 57 to 58

Slow SQL queries (200-400ms) observed when uploading many files
simultaneously. The query `WHERE uid = '...' AND delete_time IS NULL`
forces a filter step after the primary key scan. Adding a partial index
allows direct lookups without filtering.
@pinglin pinglin merged commit c8f4c5c into main Feb 2, 2026
6 of 7 checks passed
@pinglin pinglin deleted the fix-db-object-uid-partial-index branch February 2, 2026 14:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants