Skip to content

Commit

Permalink
Setting indexes for getuserprofile (#474)
Browse files Browse the repository at this point in the history
  • Loading branch information
andyoknen authored Nov 23, 2022
1 parent 27e70c4 commit a7f2b03
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
1 change: 1 addition & 0 deletions src/pocketdb/migrations/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
4 changes: 2 additions & 2 deletions src/pocketdb/repositories/web/WebRpcRepository.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -789,15 +789,15 @@ 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
) as SubscribesCount
, (
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
Expand Down

0 comments on commit a7f2b03

Please sign in to comment.