Since innoDB does not include full-text search, I decided to add a mirror table on the MyISAM engine with the FULLTEXT index, in addition to the main table. Example:
CREATE TABLE IF NOT EXISTS `tab_search` ( id INT NOT NULL AUTO_INCREMENT, id_post INT( 33 ), text_post MEDIUMTEXT, FULLTEXT (`text_post`), PRIMARY KEY ( `id` ), ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci CREATE TABLE IF NOT EXISTS `tab_main` ( id INT NOT NULL AUTO_INCREMENT, id_user INT( 33 ), id_post INT( 33 ), text_post MEDIUMTEXT, PRIMARY KEY ( `id` ), ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; To output user data to the page I use the table tab_main . For search I use tab_search . The data in both tables are recorded simultaneously. The search query is as follows:
SELECT tab_main.id_user, MATCH (tab_search.text_post) AGAINST ('$my_text' IN BOOLEAN MODE) AS relev FROM tab_main, tab_search WHERE tab_main.id_post=tab_search.id_post AND MATCH (tab_search.text_post) AGAINST ('$my_text' IN BOOLEAN MODE) ORDER BY relev DESC As you can see from these examples, the text_post field text_post contained in both tables. This means that the same data must be stored on both tables. This also means that you will have to allocate twice as much memory to store this data. Question. Is it possible to completely remove the text_post field from the tab_search table, but remove it in such a way that the data on indexes are recorded in the table. Simply put, create a separate table with indexes only, and remove all unnecessary.
text_postfrom thetab_searchtable in order to save disk space. - StasHappy