3 ms·
You're not going to get very much faster than a full table scan with this setup. If an int column has values from 1-10, indexes don't help, for the obvious rea
by aristus 18y ago
You're not going to get very much faster than a full table scan with this setup.
If an int column has values from 1-10, indexes don't help, for the obvious reason that there will only be 10 index buckets to put things into. I will bet more than one of your 40 (40?!) columns has a restricted set of values.
You could try playing with the order of the where clause, and/or try sticking the entire database into RAM.
- xirium 18y agoFor MySQL Server 4 and below, simple indexes and compound indexes with three or less values are ignored. For MySQL Server 5 and above, the heuristic is more vague. Anyhow, if one or more columns has a combined total of three or more values then an index could reduce a table scan to a range scan.