Skip to content

Commit

Permalink
Merge pull request #17830 from mvdbeek/add_extension_index
Browse files Browse the repository at this point in the history
[24.0] Fix very slow user data table query
  • Loading branch information
jdavcs authored Mar 25, 2024
2 parents 96fbfce + e74d078 commit ec1dc96
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 1 deletion.
2 changes: 1 addition & 1 deletion lib/galaxy/model/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -10910,7 +10910,7 @@ def __repr__(self):
Column("blurb", TrimmedString(255)),
Column("peek", TEXT, key="_peek"),
Column("tool_version", TEXT),
Column("extension", TrimmedString(64)),
Column("extension", TrimmedString(64), index=True),
Column("metadata", MetadataType, key="_metadata"),
Column("metadata_deferred", Boolean, key="metadata_deferred"),
Column("parent_id", Integer, ForeignKey("history_dataset_association.id"), nullable=True),
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
"""Add index on history_dataset_association extension
Revision ID: 55f02fd8ab6c
Revises: 2dc3386d091f
Create Date: 2024-03-25 11:14:40.005394
"""

from galaxy.model.database_object_names import build_index_name
from galaxy.model.migrations.util import (
create_index,
drop_index,
)

# revision identifiers, used by Alembic.
revision = "55f02fd8ab6c"
down_revision = "2dc3386d091f"
branch_labels = None
depends_on = None


hda_table_name = "history_dataset_association"
hda_extension_column_name = "extension"
hda_extension_index_name = build_index_name(hda_table_name, hda_extension_column_name)


def upgrade():
create_index(hda_extension_index_name, hda_table_name, [hda_extension_column_name])


def downgrade():
drop_index(hda_extension_index_name, hda_table_name)

0 comments on commit ec1dc96

Please sign in to comment.