th3*_*ler 10 mysql fulltext-index
我希望运行一个查询,它将返回一个FULLTEXT索引表中的列列表.该表是MyISAM格式,我将使用php来构造查询.
理想情况下,我会运行查询,它将返回信息,以便我可以构造一个逗号分隔的列的字符串.
例如"first_name,last_name,email"
这在MySQL中可行吗?
Ike*_*ker 23
您可以从information_schema.STATISTICS表中获取该信息.
我会给你一个查询来获取表中所有列在一个或多个FULLTEXT索引中的列,因为我认为这就是你要求的.请记住,每个FULLTEXT索引中列的特定组合非常重要.MySQL不能使用FULLTEXT索引来搜索多个列,除非有一个包含所有这些列的FULLTEXT索引.
这是第一个提供您要求的输出的查询:
select group_concat(distinct column_name)
from information_schema.STATISTICS
where table_schema = 'your_db'
and table_name = 'your_table'
and index_type = 'FULLTEXT';
Run Code Online (Sandbox Code Playgroud)
这里有一个显示FULLTEXT索引中列的各种组合,如果表上有多个列:
select index_name, group_concat(column_name) as columns
from information_Schema.STATISTICS
where table_schema = 'your_db'
and table_name = 'your_table'
and index_type = 'FULLTEXT'
group by index_name;
Run Code Online (Sandbox Code Playgroud)