From 58930972b025dce4c1cd3b1c824528feb1fc5829 Mon Sep 17 00:00:00 2001 From: david Date: Thu, 20 Jun 2024 15:11:47 +1000 Subject: [PATCH] Group Triples with same subject to improve performance. Sort reverse order to put pattern matches with more variables last. --- prez/services/query_generation/umbrella.py | 1 + 1 file changed, 1 insertion(+) diff --git a/prez/services/query_generation/umbrella.py b/prez/services/query_generation/umbrella.py index ed270921..9cf8d40e 100755 --- a/prez/services/query_generation/umbrella.py +++ b/prez/services/query_generation/umbrella.py @@ -97,6 +97,7 @@ def __init__( # for listing queries only, add an inner select to the where clause ss_gpotb = [] if inner_select_tssp_list: + inner_select_tssp_list = sorted(inner_select_tssp_list, key=lambda x: str(x), reverse=True) # grouping for performance ss_gpotb.append(TriplesBlock.from_tssp_list(inner_select_tssp_list)) if inner_select_gpnt: ss_gpotb.extend(inner_select_gpnt)