REFRESH INVERTED INDEX
TiDB Cloud Lake は、新しいデータが書き込まれるたびに SYNC モードで転置インデックスを自動的に更新します。REFRESH INVERTED INDEX は主に、インデックスが宣言される前から存在していた行をバックフィルするために使用します。
構文
REFRESH INVERTED INDEX <index> ON [<database>.]<table> [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