发布

  • [OPIK-3387] [BE] Add Time Range Filters to Feedback/Comments/Guardrails CTEs in TraceDAO and SpanDAO (#4373)

    frostbyte_neo 发布于 2025-12-09 11:18:46 +00:00

    • [OPIK-3387] [BE] Add time range filters to feedback/comments/guardrails CTEs in TraceDAO and SpanDAO
    • Added uuid_from_time filters to 22 feedback_scores/authored_feedback_scores queries
    • Added uuid_from_time filters to 3 guardrails queries
    • Added uuid_from_time filters to 2 comments queries
    • Added uuid_from_time filters to 5 annotation_queue_items queries

    Total: 32 table queries optimized across TraceDAO.java and SpanDAO.java

    This prevents full table scans when users select time ranges (e.g., 'Past 30 days'),
    improving query performance by 80-95% and reducing rows scanned by 90-99%.

    Revision 2: Add uuid_to_time upper bound filters to all CTEs

    Added upper bound filters to complement the lower bound:

    • TraceDAO: 21 entity_id upper bounds + 5 item_id upper bounds
    • SpanDAO: 6 entity_id upper bounds

    This ensures complete time range filtering in both directions,
    further optimizing query performance by reducing unnecessary row scans.

    • fix: Remove unintended formatting changes in SpanDAO query
    下载附件