Skip to content

Commit

Permalink
Fix join condition for nested collection query
Browse files Browse the repository at this point in the history
For a list:list:list collection this brings the query from 12.5 seconds
(after the database cache is already hot ...) to 11 ms
  • Loading branch information
mvdbeek committed Oct 18, 2023
1 parent 6d8cbee commit e617099
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions lib/galaxy/model/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -6145,9 +6145,9 @@ def attribute_columns(column_collection, attributes, nesting_level=None):
inner_dc = alias(DatasetCollection)
inner_dce = alias(DatasetCollectionElement)
order_by_columns.append(inner_dce.c.element_index)
q = q.join(inner_dc, inner_dc.c.id == dce.c.child_collection_id).outerjoin(
inner_dce, inner_dce.c.dataset_collection_id == inner_dc.c.id
)
q = q.join(
inner_dc, and_(inner_dc.c.id == dce.c.child_collection_id, dce.c.dataset_collection_id == dc.c.id)
).outerjoin(inner_dce, inner_dce.c.dataset_collection_id == inner_dc.c.id)
q = q.add_columns(
*attribute_columns(inner_dce.c, element_attributes, nesting_level),
*attribute_columns(inner_dc.c, collection_attributes, nesting_level),
Expand Down

0 comments on commit e617099

Please sign in to comment.