Documentation Home
MySQL 9.1 Reference Manual
Related Documentation Download this Manual
PDF (US Ltr) - 40.4Mb
PDF (A4) - 40.5Mb
Man Pages (TGZ) - 259.5Kb
Man Pages (Zip) - 366.7Kb
Info (Gzip) - 4.1Mb
Info (Zip) - 4.1Mb


MySQL 9.1 Reference Manual  / ...  / INFORMATION_SCHEMA Tables  / INFORMATION_SCHEMA InnoDB Tables  /  The INFORMATION_SCHEMA INNODB_FT_INDEX_TABLE Table

28.4.19 The INFORMATION_SCHEMA INNODB_FT_INDEX_TABLE Table

TheINNODB_FT_INDEX_TABLE table provides information about the inverted index used to process text searches against theFULLTEXT index of anInnoDB table.

This table is empty initially. Before querying it, set the value of theinnodb_ft_aux_table system variable to the name (including the database name) of the table that contains theFULLTEXT index (for example,test/articles).

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

TheINNODB_FT_INDEX_TABLE table has these columns:

  • WORD

    A word extracted from the text of the columns that are part of aFULLTEXT.

  • FIRST_DOC_ID

    The first document ID in which this word appears in theFULLTEXT index.

  • LAST_DOC_ID

    The last document ID in which this word appears in theFULLTEXT index.

  • DOC_COUNT

    The number of rows in which this word appears in theFULLTEXT index. The same word can occur several times within the cache table, once for each combination ofDOC_ID andPOSITION values.

  • DOC_ID

    The document ID of the row containing the word. 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 byInnoDB when the table contains no suitable column.

  • POSITION

    The position of this particular instance of the word within the relevant document identified by theDOC_ID value.

Notes

  • This table is empty initially. Before querying it, set the value of theinnodb_ft_aux_table system variable to the name (including the database name) of the table that contains theFULLTEXT index (for example,test/articles). The following example demonstrates how to use theinnodb_ft_aux_table system variable to show information about aFULLTEXT index for a specified table. Before information for newly inserted rows appears inINNODB_FT_INDEX_TABLE, theFULLTEXT index cache must be flushed to disk. This is accomplished by running anOPTIMIZE TABLE operation on the indexed table with theinnodb_optimize_fulltext_only system variable enabled. (The example disables that variable again at the end because it is intended to be enabled only temporarily.)

    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_optimize_fulltext_only=ON;mysql> OPTIMIZE TABLE articles;+---------------+----------+----------+----------+| Table         | Op       | Msg_type | Msg_text |+---------------+----------+----------+----------+| test.articles | optimize | status   | OK       |+---------------+----------+----------+----------+mysql> SET GLOBAL innodb_ft_aux_table = 'test/articles';mysql> SELECT WORD, DOC_COUNT, DOC_ID, POSITION       FROM INFORMATION_SCHEMA.INNODB_FT_INDEX_TABLE 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 |+------------+-----------+--------+----------+mysql> SET GLOBAL innodb_optimize_fulltext_only=OFF;
  • You must have thePROCESS privilege to query this table.

  • Use theINFORMATION_SCHEMACOLUMNS table or theSHOW COLUMNS statement to view additional information about the columns of this table, including data types and default values.

  • For more information aboutInnoDBFULLTEXT search, seeSection 17.6.2.4, “InnoDB Full-Text Indexes”, andSection 14.9, “Full-Text Search Functions”.