数据非常多 ,1000多万 title为聚合索引(因为主要要搜索title), id 和userid各建立非集合索引
现在发现执行语句select title from 表 where userid = 1 如果结果有几万条,非常慢,导致超时.
执行select count(id) from 表 where userid =1 却非常快.
请问要如何改善索引?
...全文
985打赏收藏
如何建立这个索引?
有张表 id,title,userid (简要) 数据非常多 ,1000多万 title为聚合索引(因为主要要搜索title), id 和userid各建立非集合索引 现在发现执行语句select title from 表 where userid = 1 如果结果有几万条,非常慢,导致超时. 执行select count(id) from 表 where userid =1 却非常快. 请问要如何改善索引?