Skip to main content

Leave Indexing and Query Patterns

Summary

The current model has 16 explicit indexes: four unique and 12 non-unique. Query methods are tracked by default and mostly unpaginated.

Audience

Backend developers, QA, database reviewers, architects, and support engineers.

Reference Content

ObjectVerified index columnsUniqueQuery useSource
LeaveRequestsworkflow instance; tenant/labor/from; tenant/statusNoID, approved overlap, status/date/labor, newest/date ordermicroservices/src/leave-service/Infrastructure/LeaveDbContext.cs
LeaveBalancestenant/user/type/yearYesexact balance and ordered listmicroservices/src/leave-service/Infrastructure/Persistence.cs
LeaveTypestenant/nameYesexact name, name ordermicroservices/src/leave-service/Application/LeaveWorkflows.cs
LeavePoliciestenant/typeYesactive type resolutionmicroservices/src/leave-service/Infrastructure/Persistence.cs
Holidaystenant/dateNorequest date range and date orderingmicroservices/src/leave-service/Application/LeaveWorkflows.cs
WeeklyOffstenant/dayNofull tenant list and ID ordermicroservices/src/leave-service/Infrastructure/Persistence.cs
EmployeeProfilestenant/user; tenant/external employeeNolabor, user, external employee, name ordermicroservices/src/leave-service/Messaging/EmployeeProfileConsumer.cs
CarryForwardstenant/user/type/target yearNorepository query root onlymicroservices/src/leave-service/Infrastructure/LeaveDbContext.cs
Encashmentstenant/user/type/yearNorepository query root onlymicroservices/src/leave-service/Infrastructure/LeaveDbContext.cs
LeaveTimelinetenant/labor/occurrenceNonewest-first, optional labor, maximum 500microservices/src/leave-service/Application/LeaveWorkflows.cs
AuditLogstenant/occurrenceNowrite path; no public query confirmedmicroservices/src/leave-service/Infrastructure/LeaveDbContext.cs
OutboxMessagesevent identity; status/occurrenceEvent identity onlyPending/Failed oldest-first bounded batchmicroservices/src/leave-service/Infrastructure/Persistence.cs

No AsNoTracking usage is present in Leave repository/query paths, so reads use EF tracking by default. General Leave, balance, type, policy, Holiday, weekly-off, and workspace lists have no pagination. Timeline and outbox polling are bounded. No performance guarantee follows from these indexes; execution plans, statistics, data distribution, and production volumes were not inspected.

Source References

  • microservices/src/leave-service/Infrastructure/LeaveDbContext.cs
  • microservices/src/leave-service/Infrastructure/Persistence.cs
  • microservices/src/leave-service/Application/LeaveWorkflows.cs
  • microservices/src/leave-service/Messaging/EmployeeProfileConsumer.cs

See Also

Keywords

  • Index inventory
  • Query patterns
  • Pagination gaps

Revision Information

  • Status: Draft
  • Last reviewed: 2026-07-15
  • Review cycle: Quarterly