📣
TiDB Cloud Premium 开放公测中。为企业级工作负载提供无限扩展、即时弹性伸缩和高级安全保障。此页面由 AI 自动翻译,英文原文请见此处。

REFRESH INVERTED INDEX



TiDB Cloud Lake 会在写入新数据时自动刷新 SYNC 模式的倒排索引。REFRESH INVERTED INDEX 主要用于回填在声明索引之前已存在的行。

语法

REFRESH INVERTED INDEX <index> ON [<database>.]<table> [LIMIT <limit>]
参数描述
<limit>指定索引刷新期间要处理的最大行数。如果未指定,则会处理表中的所有行。

示例

-- Existing table with data loaded before the index was declared CREATE TABLE IF NOT EXISTS customer_feedback(id INT, body STRING); INSERT INTO customer_feedback VALUES (1, 'Great coffee beans'), (2, 'Needs fresh roasting'); -- Create the inverted index afterward CREATE INVERTED INDEX customer_feedback_idx ON customer_feedback(body); -- Backfill historical rows so the index covers earlier inserts REFRESH INVERTED INDEX customer_feedback_idx ON customer_feedback; -- Future inserts refresh automatically in SYNC mode

文档内容是否有帮助?