Skip to content

Commit

Permalink
Slot graph: handle large query results (#1432)
Browse files Browse the repository at this point in the history
For long running mirrors, the number of entries of slot records can grow
very large.
This causes UI to hang when we select 1 day or 1 month. 
This PR attempts to speed up the fetch by adding an index to updated_at
and removing fetch of wal_status which was not being used anyways

---------

Co-authored-by: Kevin Biju <[email protected]>
  • Loading branch information
Amogh-Bharadwaj and heavycrystal authored Mar 8, 2024
1 parent 0496eb5 commit 9c563b5
Show file tree
Hide file tree
Showing 3 changed files with 1 addition and 3 deletions.
1 change: 1 addition & 0 deletions nexus/catalog/migrations/V20__slot_updated_at.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
CREATE INDEX index_slot_updated_at ON peerdb_stats.peer_slot_size (updated_at);
2 changes: 0 additions & 2 deletions ui/app/api/peers/slots/[name]/route.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@ export async function GET(
select: {
updated_at: true,
slot_size: true,
wal_status: true,
},
where: {
slot_name: context.params.name,
Expand All @@ -53,7 +52,6 @@ export async function GET(
' ' +
lagPoint.updated_at.toLocaleTimeString(),
slotSize: lagPoint.slot_size?.toString(),
walStatus: lagPoint.wal_status,
};
});

Expand Down
1 change: 0 additions & 1 deletion ui/app/dto/PeersDTO.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,5 +55,4 @@ export type PeerSetter = React.Dispatch<React.SetStateAction<PeerConfig>>;
export type SlotLagPoint = {
updatedAt: string;
slotSize?: string;
walStatus: string | null;
};

0 comments on commit 9c563b5

Please sign in to comment.