Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
-- Placeholder for 1.12.8 MySQL post-data migration script
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
-- Placeholder for 1.12.8 MySQL schema changes
-- The Postgres-side fix for #27158 has no MySQL counterpart: MySQL's
-- 1.11.0 indexes were already non-partial (no partial-index syntax in
-- MySQL), so the regression that hit Postgres did not affect MySQL.
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
-- Placeholder for 1.12.8 PostgreSQL post-data migration script
27 changes: 27 additions & 0 deletions bootstrap/sql/migrations/native/1.12.8/postgres/schemaChanges.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
-- Issue #27158: tag_usage seq-scan on Postgres. #24063 dropped the
-- `state = 1` predicate that 1.11.0's partial indexes required.
-- Fix: add a single-col index, and drop the `WHERE state = 1` filter
-- from the existing partials so query changes can't invalidate them.
Comment on lines +1 to +4
Copy link

Copilot AI Apr 26, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PR description references applying the fix under native/2.0.1/postgres/schemaChanges.sql, but the actual change is introduced in native/1.12.8/postgres/schemaChanges.sql. Please align the PR description (and/or title) with the versioned migration directory that is actually being modified to avoid confusion during verification/rollout.

Copilot uses AI. Check for mistakes.

CREATE INDEX CONCURRENTLY IF NOT EXISTS idx_tag_usage_targetfqnhash_lower_pattern
ON tag_usage (targetfqnhash_lower text_pattern_ops);

DROP INDEX CONCURRENTLY IF EXISTS idx_tag_usage_target_prefix_covering;
CREATE INDEX CONCURRENTLY IF NOT EXISTS idx_tag_usage_target_prefix_covering
ON tag_usage (source, targetfqnhash_lower text_pattern_ops)
INCLUDE (tagFQN, labelType, state);

DROP INDEX CONCURRENTLY IF EXISTS idx_tag_usage_tagfqn_prefix_covering;
CREATE INDEX CONCURRENTLY IF NOT EXISTS idx_tag_usage_tagfqn_prefix_covering
ON tag_usage (source, tagfqn_lower text_pattern_ops)
INCLUDE (targetFQNHash, labelType, state);

DROP INDEX CONCURRENTLY IF EXISTS idx_tag_usage_join_source;
CREATE INDEX CONCURRENTLY IF NOT EXISTS idx_tag_usage_join_source
ON tag_usage (tagFQNHash, source)
INCLUDE (targetFQNHash, tagFQN, labelType, state);

CREATE EXTENSION IF NOT EXISTS pg_trgm;
DROP INDEX CONCURRENTLY IF EXISTS gin_tag_usage_targetfqn_trgm;
CREATE INDEX CONCURRENTLY IF NOT EXISTS gin_tag_usage_targetfqn_trgm
ON tag_usage USING GIN (targetFQNHash gin_trgm_ops);
Loading