问题
I have a table with many (maybe more than 500) different attributs in an "attribut"-column and wanted to find the rows, which contans many certan attributs (~ 200). The query to find them would contain a huge number of where-clauses.
How many where-clauses is okay, to have an acceptable performance?
回答1:
It's not the quantity that matters. It's how well you've designed your database structure and query that matter.
Make sure you have an index on the columns that will be used in your where queries
Place your
WHERE
statements in the order that will match the least rows first and proceed like that.
Here's MySQL's WHERE clause optimization guide for more tips
来源:https://stackoverflow.com/questions/11795414/how-many-where-clauses-in-mysql-query-is-too-many