Skip to content

Add indexes on samples.originating_data_file_id and samples.sample_type_id#2637

Open
stuzart wants to merge 1 commit into
seek-1.18from
add-samples-indexes
Open

Add indexes on samples.originating_data_file_id and samples.sample_type_id#2637
stuzart wants to merge 1 commit into
seek-1.18from
add-samples-indexes

Conversation

@stuzart

@stuzart stuzart commented Jun 23, 2026

Copy link
Copy Markdown
Member

Summary

  • Adds a missing index on samples.originating_data_file_id, which was introduced in 2016 without one
  • Adds a missing index on samples.sample_type_id

Both columns are frequently used as WHERE filters but were causing full table scans on the samples table.

originating_data_file_id is queried on every DataFile show page (via the related items tab and asset buttons partial). sample_type_id is queried during sample extraction, metadata updates, and attribute resolution for linked samples.

Both values are set once at bulk import time (Sample.import with batch_size: 2000) and not subsequently changed, so the insert overhead is negligible.

@stuzart stuzart added this to the 1.18.1 milestone Jun 23, 2026
@stuzart stuzart moved this to In review in SEEK 1.18.x Jun 23, 2026
@stuzart stuzart requested a review from fbacall June 23, 2026 16:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: In review

Development

Successfully merging this pull request may close these issues.

1 participant