From a7f2b039b51e288cd009718be44c3c2c21bb9254 Mon Sep 17 00:00:00 2001 From: Andy Oknen Date: Wed, 23 Nov 2022 14:22:48 +0300 Subject: [PATCH] Setting indexes for getuserprofile (#474) --- src/pocketdb/migrations/main.cpp | 1 + src/pocketdb/repositories/web/WebRpcRepository.cpp | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/pocketdb/migrations/main.cpp b/src/pocketdb/migrations/main.cpp index 8fc93a993..6ffad7feb 100644 --- a/src/pocketdb/migrations/main.cpp +++ b/src/pocketdb/migrations/main.cpp @@ -219,6 +219,7 @@ namespace PocketDb create index if not exists Transactions_Type_Last_String4_Height on Transactions (Type, Last, String4, Height); create index if not exists Transactions_Type_Last_String5_Height on Transactions (Type, Last, String5, Height); create index if not exists Transactions_Type_Last_String1_String2_Height on Transactions (Type, Last, String1, String2, Height); + create index if not exists Transactions_Type_Last_String2_String1_Height on Transactions (Type, Last, String2, String1, Height); create index if not exists Transactions_Type_Last_Height_String5_String1 on Transactions (Type, Last, Height, String5, String1); create index if not exists Transactions_Type_Last_Height_Id on Transactions (Type, Last, Height, Id); create index if not exists Transactions_Type_String1_String2_Height on Transactions (Type, String1, String2, Height); diff --git a/src/pocketdb/repositories/web/WebRpcRepository.cpp b/src/pocketdb/repositories/web/WebRpcRepository.cpp index e70515c8b..a35875216 100644 --- a/src/pocketdb/repositories/web/WebRpcRepository.cpp +++ b/src/pocketdb/repositories/web/WebRpcRepository.cpp @@ -789,7 +789,7 @@ namespace PocketDb , ( select count() - from Transactions subs indexed by Transactions_Type_Last_String1_Height_Id + from Transactions subs indexed by Transactions_Type_Last_String1_String2_Height cross join Transactions uas indexed by Transactions_Type_Last_String1_Height_Id on uas.String1 = subs.String2 and uas.Type = 100 and uas.Last = 1 and uas.Height is not null where subs.Type in (302,303) and subs.Height > 0 and subs.Last = 1 and subs.String1 = u.String1 @@ -797,7 +797,7 @@ namespace PocketDb , ( select count() - from Transactions subs indexed by Transactions_Type_Last_String2_Height + from Transactions subs indexed by Transactions_Type_Last_String2_String1_Height cross join Transactions uas indexed by Transactions_Type_Last_String1_Height_Id on uas.String1 = subs.String1 and uas.Type = 100 and uas.Last = 1 and uas.Height is not null where subs.Type in (302,303) and subs.Height > 0 and subs.Last = 1 and subs.String2 = u.String1