DROP INDEX idx_threads_section_recency_at_ms; DROP INDEX idx_threads_section_position; CREATE INDEX idx_threads_section_recency_at_ms ON threads(archived, thread_section_id, recency_at_ms DESC, id DESC) WHERE thread_section_id IS NOT NULL; CREATE INDEX idx_threads_section_position ON threads(archived, thread_section_id, section_position ASC, id ASC) WHERE thread_section_id IS NOT NULL;