fix(db): bound automation log truth-chain lookups
Some checks failed
CD Pipeline / workflow-shape (push) Successful in 0s
CD Pipeline / cancel-stale-cd (push) Has been skipped
CD Pipeline / build-and-deploy (push) Has been cancelled
CD Pipeline / post-deploy-checks (push) Has been cancelled
CD Pipeline / tests (push) Has been cancelled

This commit is contained in:
Your Name
2026-07-01 09:00:34 +08:00
parent 444de0b40c
commit 548127ffb0
5 changed files with 124 additions and 14 deletions

View File

@@ -0,0 +1,16 @@
-- P0 post-reboot CPU pressure: bound truth-chain automation_operation_log lookups.
-- Run outside an explicit transaction because CREATE INDEX CONCURRENTLY requires it.
CREATE EXTENSION IF NOT EXISTS pg_trgm;
CREATE INDEX CONCURRENTLY IF NOT EXISTS idx_automation_operation_log_incident_text
ON automation_operation_log ((incident_id::text))
WHERE incident_id IS NOT NULL;
CREATE INDEX CONCURRENTLY IF NOT EXISTS idx_automation_operation_log_input_text_trgm
ON automation_operation_log
USING gin ((coalesce(input::text, '')) gin_trgm_ops);
CREATE INDEX CONCURRENTLY IF NOT EXISTS idx_automation_operation_log_output_text_trgm
ON automation_operation_log
USING gin ((coalesce(output::text, '')) gin_trgm_ops);

View File

@@ -0,0 +1,6 @@
-- Roll back only indexes owned by the P0 automation_operation_log truth-chain migration.
-- Do not drop pg_trgm; the extension may be shared by other indexes.
DROP INDEX CONCURRENTLY IF EXISTS idx_automation_operation_log_output_text_trgm;
DROP INDEX CONCURRENTLY IF EXISTS idx_automation_operation_log_input_text_trgm;
DROP INDEX CONCURRENTLY IF EXISTS idx_automation_operation_log_incident_text;