forked from digma-ai/forkof-spring-petclinic
-
Notifications
You must be signed in to change notification settings - Fork 4
Open
Description
Issue Description
The /query-logs endpoint is experiencing severe performance degradation with high response times (30s+) due to inefficient query implementation and missing index.
Root Cause Analysis
- Missing index on clinic_activity_logs.numeric_value column
- No pagination implementation leading to large result sets
- Direct JDBC usage instead of JPA
- Unnecessary query repetitions
- No result caching
Solution
PR #435 implements the following improvements:
- Added index on numeric_value column:
CREATE INDEX crystaldba_idx_clinic_activity_logs_numeric_value_1 ON clinic_activity_logs USING btree (numeric_value)- Implemented pagination in the endpoint
- Replaced JDBC with JPA repository
- Added result caching
- Removed query repetitions parameter
Performance Impact
- Query execution time: 30s → 22ms (5904x improvement)
- Controlled memory usage with pagination
- Reduced database load with caching
Validation
- Index creation verified
- Query performance improvement confirmed
- Pagination functionality tested
Related PR: #435
Metadata
Metadata
Assignees
Labels
No labels