24.4.12 The INFORMATION_SCHEMA INNODB_FT_INDEX_CACHE Table (original) (raw)

24.4.12 The INFORMATION_SCHEMA INNODB_FT_INDEX_CACHE Table

The INNODB_FT_INDEX_CACHE table provides token information about newly inserted rows in aFULLTEXT index. To avoid expensive index reorganization during DML operations, the information about newly indexed words is stored separately, and combined with the main search index only when OPTIMIZE TABLE is run, when the server is shut down, or when the cache size exceeds a limit defined by theinnodb_ft_cache_size orinnodb_ft_total_cache_size system variable.

This table is empty initially. Before querying it, set the value of the innodb_ft_aux_table system variable to the name (including the database name) of the table that contains the FULLTEXT index; for exampletest/articles.

For related usage information and examples, seeSection 14.16.4, “InnoDB INFORMATION_SCHEMA FULLTEXT Index Tables”.

The INNODB_FT_INDEX_CACHE table has these columns:

Notes

mysql> USE test;  
mysql> CREATE TABLE articles (  
         id INT UNSIGNED AUTO_INCREMENT NOT NULL PRIMARY KEY,  
         title VARCHAR(200),  
         body TEXT,  
         FULLTEXT (title,body)  
       ) ENGINE=InnoDB;  
mysql> INSERT INTO articles (title,body) VALUES  
       ('MySQL Tutorial','DBMS stands for DataBase ...'),  
       ('How To Use MySQL Well','After you went through a ...'),  
       ('Optimizing MySQL','In this tutorial we show ...'),  
       ('1001 MySQL Tricks','1. Never run mysqld as root. 2. ...'),  
       ('MySQL vs. YourSQL','In the following database comparison ...'),  
       ('MySQL Security','When configured properly, MySQL ...');  
mysql> SET GLOBAL innodb_ft_aux_table = 'test/articles';  
mysql> SELECT WORD, DOC_COUNT, DOC_ID, POSITION  
       FROM INFORMATION_SCHEMA.INNODB_FT_INDEX_CACHE LIMIT 5;  
+------------+-----------+--------+----------+  
| WORD       | DOC_COUNT | DOC_ID | POSITION |  
+------------+-----------+--------+----------+  
| 1001       |         1 |      4 |        0 |  
| after      |         1 |      2 |       22 |  
| comparison |         1 |      5 |       44 |  
| configured |         1 |      6 |       20 |  
| database   |         2 |      1 |       31 |  
+------------+-----------+--------+----------+