I am trying to select about 800,000 rows in 7+ millon table using this query
SELECT * FROM news_completed USE INDEX (brand_id) WHERE `brand_id`IN (6346,6324,364,6460,6341,6495,6340,6438,6496,6439,6345,6344,6343,6497,6446,6450,6445,6443,6338,6440,6492,6449,6435,6609,6493,6347,6442,6339,6437,6444,6436,6494,6342,6575,6574,6576);
Column brand_id is indexed but index is not used, even if I force use in the query. EXPLAIN statement: http://hpics.li/209e767
But, if I reduce the number of brands within the IN to half (aprox), then the brand_id index is used: http://hpics.li/02f9822
Could you explain me what is this limitation and how I can avoid it? Or build my query in a more efficient way?
Thanks a lot, Maxime.