7c78c09046
asyncpg prepare가 다중 statement 불가. 117(stale 정리) → 118(constraint 제거) → 119(partial unique index 생성) 순차 실행. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
9 lines
314 B
SQL
9 lines
314 B
SQL
-- stale duplicate 삭제 (processing 10분+ 방치 + 같은 doc/stage에 pending 존재)
|
|
DELETE FROM processing_queue a
|
|
USING processing_queue b
|
|
WHERE a.document_id = b.document_id
|
|
AND a.stage = b.stage
|
|
AND a.status = 'processing'
|
|
AND a.started_at < NOW() - INTERVAL '10 minutes'
|
|
AND b.status = 'pending'
|