Skip to content

Commit 019b503

Browse files
committed
fix (FTS3DB): use selectin join instead of subquery to speed up getNonFinishedOperations
1 parent d2d84ec commit 019b503

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

src/DIRAC/DataManagementSystem/DB/FTS3DB.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -127,10 +127,11 @@
127127
),
128128
"ftsJobs": relationship(
129129
FTS3Job,
130-
lazy="subquery", # Immediately load the entirety of the object,
130+
lazy="selectin", # Immediately load the entirety of the object,
131131
# but use a subquery to do it
132132
# This is to avoid the cartesian product between the three tables.
133-
# https://docs.sqlalchemy.org/en/latest/orm/loading_relationships.html#subquery-eager-loading
133+
# https://docs.sqlalchemy.org/en/20/orm/queryguide/relationships.html#selectin-eager-loading
134+
# We use selectin and not subquery because of https://github.com/DIRACGrid/DIRAC/issues/6814
134135
cascade="all, delete-orphan", # if a File is removed from the list,
135136
# remove it from the DB
136137
passive_deletes=True, # used together with cascade='all, delete-orphan'

0 commit comments

Comments
 (0)