Skip to content

Performance Issue: Slow queries on clinic_activity_logs table-created-by-agentic #117

@doppleware

Description

@doppleware

A critical performance issue has been identified in the clinic_activity_logs table queries.

Problem Description

  • Query execution time: 2.69s (expected: 653.25μs)
  • Full sequential scan on numeric_value column
  • Low table cache hit rate (20.6%)
  • Affects /api/clinic-activity/query-logs endpoint
  • 652 samples showing consistent degradation
  • Z-Score: 12.37 (severe deviation from normal)

Root Cause

Missing index on the numeric_value column causing full table scans.

Solution

  1. Created index on numeric_value column
  2. Added migration file for the index
  3. Verified performance improvement
    • Before: 2.69s
    • After: ~0.3ms

Related

Monitoring

  • Query performance has been verified
  • Cache hit rates should be monitored
  • Additional optimization may be needed if load increases further

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions