-- Audit Low finding: speeding up the "list all DL for app" view.
--
-- The dashboard's dead-letters tab issues
--   SELECT ... FROM dead_letters
--     WHERE app_id = $1
--     ORDER BY created_at DESC LIMIT $2
-- which falls back to a seq-scan + sort when the unresolved=false
-- filter is on (the partial idx_dead_letters_app_unresolved doesn't
-- cover resolved rows). This composite covers both modes.

CREATE INDEX IF NOT EXISTS idx_dead_letters_app_created
    ON dead_letters (app_id, created_at DESC);
