- Create migration 2026-02-03_add_auth_locked_index.sql - Add partial index on locked_until with active lockout condition - Replace previous generic locked_until index with optimized version - Index filters for locked_until IS NOT NULL AND locked_until > NOW() - Improves query performance for account unlock validation - Resolves GAP-009 Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
28 lines
1.1 KiB
SQL
28 lines
1.1 KiB
SQL
-- =====================================================
|
|
-- Migration: Add GIN indexes for llm schema
|
|
-- Task: ST-4.4, GAP-012
|
|
-- Date: 2026-02-03
|
|
-- Description: Add GIN indexes for array columns in llm.conversations
|
|
-- for optimized full-text tag searches
|
|
-- =====================================================
|
|
|
|
-- GIN index on tags array for fast tag searches
|
|
CREATE INDEX IF NOT EXISTS idx_conversations_tags_gin
|
|
ON llm.conversations USING GIN(tags);
|
|
|
|
-- GIN index on related_symbols for symbol searches
|
|
CREATE INDEX IF NOT EXISTS idx_conversations_symbols_gin
|
|
ON llm.conversations USING GIN(related_symbols);
|
|
|
|
-- GIN index on related_topics for topic searches
|
|
CREATE INDEX IF NOT EXISTS idx_conversations_topics_gin
|
|
ON llm.conversations USING GIN(related_topics);
|
|
|
|
-- =====================================================
|
|
-- Verification
|
|
-- =====================================================
|
|
-- To verify indexes were created:
|
|
-- SELECT indexname FROM pg_indexes
|
|
-- WHERE tablename='conversations' AND schemaname='llm';
|
|
-- =====================================================
|