SQL Performance checklist: Avoid index filter predicates.
use-the-index-luke.com
use-the-index-luke.com
SELECT count() FROM scale_data WHERE section = ? AND id2 = ?
would be re-written with row values as:
SELECT count() FROM scale_data WHERE (section,id2) = (?,?)
In such a case, the database will revert to a table scan if it can't find an index that matches all of the columns (in left-to-right order) in the row value on the left-hand side of the expression, which would be immediately apparent in the actual performance of the query and the query execution plan.
In a situation which other queries would benefit from the id1, id2 order, and it wouldn't pay off creating another index, using a index seek instead a table scan is way better.