V
V
Vladimir Golubev2017-01-31 21:50:09
MySQL
Vladimir Golubev, 2017-01-31 21:50:09

Do I need an index on multiple WHERE IN() conditions?

The query will always take into account all fields, but it will look something like this:

SELECT * FROM someTable
WHERE 
someId1 IN (0, findId1) 
AND 
someId2 IN (0, findId2) 
AND ...

The question is, will a complex index on (someId1, someId2, ...) be used, or does B-tree allow only equals to search by index?
And will it be effective if the table size is up to 5k rows?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
N
neol, 2017-01-31
@wladyspb

Will. EXPLAIN can answer such questions.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question