Skip to main content

Attendance Indexing and Query Patterns

Summary

The current model configures 18 indexes across 13 objects. They target tenant/date, workflow, effective-date, active/default, history-ordering, and outbox polling patterns.

Audience

  • Backend developers, database reviewers, QA engineers, and support engineers

Reference Content

Index inventory

ObjectConfirmed index purposeEnforcement
Attendance recordtenant/employee/date; tenant/date/approval/statusBoth non-unique
Punchtenant/employee/timeNon-unique chronological lookup
Reopen requesttenant/employee/date/statusNon-unique pending lookup
Employee profiletenant/activeNon-unique availability lookup
Payroll snapshottenant/employee/periodUnique
Shiftglobal compatibility identity; tenant/activeUnique + non-unique
Weekly offtenant/dayUnique
Policytenant/active; filtered tenant defaultNon-unique + unique
Policy rulepolicy/keyUnique
Shift assignmenttenant/employee/from; tenant/ShiftNon-unique
Audit and timelinetenant/time eachNon-unique
Outboxevent identity; status/timeUnique + non-unique

Queries commonly use AsNoTracking for lists and projections, order daily Attendance by date, punches by time, assignments by latest effective start, history newest-first, and outbox oldest-first. Timeline/audit and outbox polling use bounded Take; most Attendance list queries do not expose database pagination and this gap is Requires confirmation for large tenants.

No performance guarantee follows from index presence. Employee/date uniqueness is not enforced despite the corresponding index.

Source References

  • microservices/src/attendance-service/Infrastructure/AttendanceDbContext.cs
  • microservices/src/attendance-service/Infrastructure/Persistence.cs
  • microservices/src/attendance-service/Application/Services/AttendanceQueries.cs
  • microservices/src/attendance-service/Application/Services/ShiftPolicyQueries.cs

See Also

Keywords

  • Attendance persistence
  • EF Core
  • PostgreSQL

Revision Information

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