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(
540540 with Session (self .engine , expire_on_commit = False ) as session :
541541 statement = select (Entry )
542542
543+ start = time .time ()
543544 if search .ast :
544545 statement = (
545546 statement .outerjoin (Entry .tag_box_fields )
546547 .outerjoin (TagBoxField .tags )
547548 .outerjoin (TagAlias )
548549 .where (SQLBoolExpressionBuilder ().visit (search .ast ))
549550 )
551+ end = time .time ()
552+ logger .info (f"Building SQL Done in { format_timespan (end - start )} " )
550553
551554 extensions = self .prefs (LibraryPrefs .EXTENSION_LIST )
552555 is_exclude_list = self .prefs (LibraryPrefs .IS_EXCLUDE_LIST )
@@ -568,7 +571,10 @@ def search_library(
568571 query_count = select (func .count (distinct (aliased_statement .c .id ))).select_from (
569572 aliased_statement
570573 )
574+ start = time .time ()
571575 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 )} " )
572578
573579 statement = statement .limit (search .limit ).offset (search .offset )
574580
@@ -578,10 +584,13 @@ def search_library(
578584 query_full = str (statement .compile (compile_kwargs = {"literal_binds" : True })),
579585 )
580586
587+ start = time .time ()
581588 res = SearchResult (
582589 total_count = count_all ,
583590 items = list (session .scalars (statement ).unique ()),
584591 )
592+ end = time .time ()
593+ logger .info (f"SQL Results Query done in { format_timespan (end - start )} " )
585594
586595 session .expunge_all ()
587596
You can’t perform that action at this time.
0 commit comments