Skip to content

Commit

Permalink
yet another fix to resource holders index and query.
Browse files Browse the repository at this point in the history
It's quicker when inserting values to have index (balance DESC, entity_id ASC), as if new value with same balance appears we'll only have to append it at the end.
  • Loading branch information
PawelPawelec-RDX committed Jan 13, 2025
1 parent b4078f8 commit 296652d
Show file tree
Hide file tree
Showing 6 changed files with 3,258 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -658,10 +658,12 @@ private static void HookupHistory(ModelBuilder modelBuilder)
.IsUnique();

// Used by Gateway API when querying resource holders endpoint.
// It's quicker when inserting values to have index (balance DESC, entity_id ASC)
// as if new value with same balance appears we'll only have to append it at the end.
modelBuilder
.Entity<ResourceHolder>()
.HasIndex(e => new { e.ResourceEntityId, e.Balance, e.EntityId })
.IsDescending(false, true, true);
.IsDescending(false, true, false);

modelBuilder
.Entity<EntityResourceTotalsHistory>()
Expand Down
Loading

0 comments on commit 296652d

Please sign in to comment.