Skip to content

Commit 0b821d5

Browse files
carderneTrigger.dev RepoOps
authored andcommitted
perf(clickhouse): add words index for log search
Add a word-based text index for log search while retaining the existing substring index. The migration does not materialize existing data. Mono-RevId: 4b75eb5059887d5f5f92b0dd7c18c7458e1bcc29
1 parent eaee8d4 commit 0b821d5

1 file changed

Lines changed: 11 additions & 0 deletions

File tree

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
-- +goose Up
2+
-- The identity expression permits ngram coexistence. ClickHouse 26.2 uses it for skip
3+
-- pruning, while 26.4 also supports direct reads from the words index. Keep this expression
4+
-- after dropping the ngram index. Do not add a follow-up migration back to the raw column.
5+
ALTER TABLE trigger_dev.task_events_search_v2
6+
ADD INDEX IF NOT EXISTS idx_search_words concat(search_text, '')
7+
TYPE text(tokenizer = 'splitByNonAlpha');
8+
9+
-- +goose Down
10+
ALTER TABLE trigger_dev.task_events_search_v2
11+
DROP INDEX IF EXISTS idx_search_words;

0 commit comments

Comments
 (0)