一、对每一条数据做精确查询。如:select 1 from User where name='xx' and id=123; 这种做法效率比较低,而且需要方法数据库n次;
二、将这两个索引字段拼成in里的元素使用一条sql查询。如:select 1 from User where name in ('x1','x2','x3',.......) and id in (1,2,3,.......) .这种方法可能查出来的结果集过大。
请问哪位大侠有比较好的解决办法? 提示:该表数据量比较大上千万级。