user198729
user198729

Reputation: 63636

Is MySQL performant with select ... in (ID1,ID2,ID3,...ID100)?

Will this kind of query bring performance issue?

Upvotes: 0

Views: 130

Answers (4)

Nathan Wheeler
Nathan Wheeler

Reputation: 5932

Sometimes yes, but sometimes this syntax is also necessary or better than any alternative you might have to achieve the same result set. In order to fully say that in your case the performance will be worse than it would be with a differently written query, we would need to know your exact query and database schema.

Upvotes: 0

Eric Petroelje
Eric Petroelje

Reputation: 60498

Assuming you have an index on whatever field you are doing the IN on, you should be fine.

Upvotes: 2

Matt Rogish
Matt Rogish

Reputation: 24873

Versus what? As long as your WHERE clause values are indexed appropriately, you should be fine (in general).

Upvotes: 0

Sampson
Sampson

Reputation: 268344

Any query will cause performance issues (to some degree, technically). The question is not whether it will cause performance issues, the question is whether it's necessary.

Upvotes: 0

Related Questions