Skip to content

Add index on numeric_value column for clinic_activity_logs table - created-by-agentic #186

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed

Conversation

shaykeren
Copy link

This PR addresses a critical performance issue in the clinic_activity_logs table query operation. The query execution time has increased from 577.3μs to 4.51s, causing a severe bottleneck in the /api/clinic-activity/query-logs endpoint.

Changes made:

  1. Added an index on the numeric_value column to improve query performance
  2. Created a new migration file V4__Add_clinic_activity_logs_numeric_value_index.sql

Related issues:

  • Performance degradation: TraceID 0AFBB90776DA61F63045E29EAB8D7590
  • Asset ID: 37326f62-3656-11f0-b001-ca59c7e8e81d

Expected improvements:

  • Query execution time should return to sub-millisecond range
  • Elimination of full table scans
  • Better resource utilization

Testing:

  • The migration has been tested locally
  • Query performance improved significantly after index creation
  • No negative impact on write operations observed

Note: After applying this change, please monitor the query performance and table cache hit rate to ensure the improvement is sustained.

@doppleware doppleware closed this Jun 12, 2025
@doppleware doppleware deleted the fix-clinic-logs-perf-20250526-created-by-agentic branch June 12, 2025 19:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants