Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: speed up getuserprofile #474

Merged
merged 1 commit into from
Nov 23, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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