File tree Expand file tree Collapse file tree 1 file changed +9
-0
lines changed
tagstudio/src/core/library/alchemy Expand file tree Collapse file tree 1 file changed +9
-0
lines changed Original file line number Diff line number Diff line change @@ -540,13 +540,16 @@ def search_library(
540
540
with Session (self .engine , expire_on_commit = False ) as session :
541
541
statement = select (Entry )
542
542
543
+ start = time .time ()
543
544
if search .ast :
544
545
statement = (
545
546
statement .outerjoin (Entry .tag_box_fields )
546
547
.outerjoin (TagBoxField .tags )
547
548
.outerjoin (TagAlias )
548
549
.where (SQLBoolExpressionBuilder ().visit (search .ast ))
549
550
)
551
+ end = time .time ()
552
+ logger .info (f"Building SQL Done in { format_timespan (end - start )} " )
550
553
551
554
extensions = self .prefs (LibraryPrefs .EXTENSION_LIST )
552
555
is_exclude_list = self .prefs (LibraryPrefs .IS_EXCLUDE_LIST )
@@ -568,7 +571,10 @@ def search_library(
568
571
query_count = select (func .count (distinct (aliased_statement .c .id ))).select_from (
569
572
aliased_statement
570
573
)
574
+ start = time .time ()
571
575
count_all : int = session .execute (query_count ).scalar ()
576
+ end = time .time ()
577
+ logger .info (f"SQL Count Query done in { format_timespan (end - start )} " )
572
578
573
579
statement = statement .limit (search .limit ).offset (search .offset )
574
580
@@ -578,10 +584,13 @@ def search_library(
578
584
query_full = str (statement .compile (compile_kwargs = {"literal_binds" : True })),
579
585
)
580
586
587
+ start = time .time ()
581
588
res = SearchResult (
582
589
total_count = count_all ,
583
590
items = list (session .scalars (statement ).unique ()),
584
591
)
592
+ end = time .time ()
593
+ logger .info (f"SQL Results Query done in { format_timespan (end - start )} " )
585
594
586
595
session .expunge_all ()
587
596
You can’t perform that action at this time.
0 commit comments