### 26.4.18 The INFORMATION\_SCHEMA INNODB\_FT\_INDEX\_CACHE Table

[]()

 The [`INNODB_FT_INDEX_CACHE`](information-schema-innodb-ft-index-cache-table.html) table provides token information about newly inserted rows in a `FULLTEXT` 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`](optimize-table.html) is run, when the server is shut down, or when the cache size exceeds a limit defined by the [`innodb_ft_cache_size`](innodb-parameters.html#sysvar_innodb_ft_cache_size) or [`innodb_ft_total_cache_size`](innodb-parameters.html#sysvar_innodb_ft_total_cache_size) system variable.

 This table is empty initially. Before querying it, set the value of the [`innodb_ft_aux_table`](innodb-parameters.html#sysvar_innodb_ft_aux_table) system variable to the name (including the database name) of the table that contains the `FULLTEXT` index (for example, `test/articles`).

 For related usage information and examples, see [Section 15.15.4, “InnoDB INFORMATION\_SCHEMA FULLTEXT Index Tables”](innodb-information-schema-fulltext_index-tables.html).

 The [`INNODB_FT_INDEX_CACHE`](information-schema-innodb-ft-index-cache-table.html) table has these columns:

* `WORD`

   A word extracted from the text of a newly inserted row.

* `FIRST_DOC_ID`

   The first document ID in which this word appears in the `FULLTEXT` index.

* `LAST_DOC_ID`

   The last document ID in which this word appears in the `FULLTEXT` index.

* `DOC_COUNT`

   The number of rows in which this word appears in the `FULLTEXT` index. The same word can occur several times within the cache table, once for each combination of `DOC_ID` and `POSITION` values.

* `DOC_ID`

   The document ID of the newly inserted row. This value might reflect the value of an ID column that you defined for the underlying table, or it can be a sequence value generated by `InnoDB` when the table contains no suitable column.

* `POSITION`

   The position of this particular instance of the word within the relevant document identified by the `DOC_ID` value. The value does not represent an absolute position; it is an offset added to the `POSITION` of the previous instance of that word.

#### Notes

* This table is empty initially. Before querying it, set the value of the [`innodb_ft_aux_table`](innodb-parameters.html#sysvar_innodb_ft_aux_table) system variable to the name (including the database name) of the table that contains the `FULLTEXT` index (for example `test/articles`). The following example demonstrates how to use the [`innodb_ft_aux_table`](innodb-parameters.html#sysvar_innodb_ft_aux_table) system variable to show information about a `FULLTEXT` index for a specified table.

  ```
  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 |
  +------------+-----------+--------+----------+
  ```

* You must have the [`PROCESS`](privileges-provided.html#priv_process) privilege to query this table.

* Use the `INFORMATION_SCHEMA` [`COLUMNS`](information-schema-columns-table.html) table or the [`SHOW COLUMNS`](show-columns.html) statement to view additional information about the columns of this table, including data types and default values.

* For more information about `InnoDB` `FULLTEXT` search, see [Section 15.6.2.4, “InnoDB Full-Text Indexes”](innodb-fulltext-index.html), and [Section 12.10, “Full-Text Search Functions”](fulltext-search.html).

