Optimize query: API Endpoints - Single Checkpoint Retrieval
File: ee/lib/api/ai/duo_workflows/workflows_internal.rb (Line 181-182)
checkpoint = workflow.checkpoints.with_checkpoint_writes.find_by_id(params[:checkpoint_id])
Generated SQL:
SELECT "p_duo_workflows_checkpoints".*
FROM "p_duo_workflows_checkpoints"
WHERE "p_duo_workflows_checkpoints"."workflow_id" = $1
AND "p_duo_workflows_checkpoints"."id" = $2
-- With eager loading of checkpoint_writes
Optimization needed: Ensure query includes created_at filter for partition pruning.