Skip to content

Add comment_threads reverse lookup index#978

Merged
raymondjacobson merged 1 commit into
mainfrom
codex/comment-threads-comment-id-index
Jun 29, 2026
Merged

Add comment_threads reverse lookup index#978
raymondjacobson merged 1 commit into
mainfrom
codex/comment-threads-comment-id-index

Conversation

@raymondjacobson

Copy link
Copy Markdown
Member

Summary

  • Add a concurrent index on comment_threads (comment_id).
  • Speeds comment-create trigger paths that check whether a newly inserted comment has a thread row by comment_id.

Context

The slow ETL sample was dominated by Comment Create outliers, including one ~2.28s handler. Several deferred comment triggers classify top-level comments vs replies with WHERE comment_id = new.comment_id, while the existing primary key is ordered as (parent_comment_id, comment_id). This index gives that reverse lookup its own narrow path.

Testing

  • git diff --check

@raymondjacobson raymondjacobson merged commit 67c66ec into main Jun 29, 2026
5 checks passed
@raymondjacobson raymondjacobson deleted the codex/comment-threads-comment-id-index branch June 29, 2026 20:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant