Moves the conn.prepare() call for fetching discussion notes outside the per-discussion loop in collect_discussion_threads(). The SQL is identical for every iteration, so preparing it once and rebinding parameters avoids redundant statement compilation on each matched discussion. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>