Optimize query: API Endpoints - Checkpoint Listing

File: ee/lib/api/ai/duo_workflows/workflows_internal.rb (Line 164-166)

checkpoints = workflow.checkpoints.ordered_with_writes
checkpoints = paginate(checkpoints)

Generated SQL:

SELECT "p_duo_workflows_checkpoints".* 
FROM "p_duo_workflows_checkpoints" 
WHERE "p_duo_workflows_checkpoints"."workflow_id" = $1 
ORDER BY "p_duo_workflows_checkpoints"."thread_ts" DESC
-- With eager loading of checkpoint_writes

Optimization needed: Ensure query includes created_at filter for partition pruning.