简体   繁体   English

有没有办法在MySQL中仅索引特定的列值?

[英]Is there a way to index only specific column values in MySQL?

I have a table of ~13 million rows, and the data in the column I am interested in is distributed like this ( http://pastebin.com/raw.php?i=aHXjB5FA ). 我有一个约1300万行的表,而我感兴趣的列中的数据是这样分布的( http://pastebin.com/raw.php?i=aHXjB5FA )。

I would like to be able to efficiently find notable values (say, 45 pts and above). 我希望能够有效地找到引人注目的价值(例如45分及以上)。 Is it possible to create an index only for the rows that have pts >= 45? 是否可以仅为pts> = 45的行创建索引?

If not, will a normal index help? 如果没有,正常索引会有所帮助吗? It seems like it would be a waste of disk space, since in this case I am only interested in ~2500 of the 13 million rows. 看来这将浪费磁盘空间,因为在这种情况下,我只对1300万行中的2500行感兴趣。 Also, each row has 12 more columns I would like to index similarly (it's a basketball statistics database). 另外,每行还有12列我希望类似地索引(这是一个篮球统计数据库)。

MySQL不支持所谓的部分索引 ,该部分索引仅将表行的子集添加到索引中。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM