diff --git a/core/api/src/services/ledger/schema.ts b/core/api/src/services/ledger/schema.ts index 88fa411a85..15a5e2b1c8 100644 --- a/core/api/src/services/ledger/schema.ts +++ b/core/api/src/services/ledger/schema.ts @@ -162,6 +162,12 @@ transactionSchema.index({ payout_id: 1 }) transactionSchema.index({ _original_journal: 1 }) transactionSchema.index({ related_journal: 1 }) transactionSchema.index({ external_id: 1 }) +transactionSchema.index({ + "book": 1, + "account_path.0": 1, + "account_path.1": 1, + "_id": -1, +}) // indexes used by balance queries transactionSchema.index({ book: 1, accounts: 1, currency: 1, _id: 1 })