The number of indexes is preferred for just one table in MYSQL??

I've got a company table where I search mostly for ID,condition and category?


There's nobody single answer with this question: create as numerous indexes are needed to create your queries fast enough, with no more.

You need to downside something more important when determining things to index:

  • The greater indexes you've, the reduced card inserts and updates is going to be (because they have to update all the indexes)
  • Queries over tables with no appropriate index can be very slow, when the database needs to perform a table scan
  • Some posts don't require indexes (for instance, a 'gender' column in which the only possible value is "M" or "F")

For the particular scenario, it appears like three indexes, one on ID (if this sounds like the main key, it already comes with an implicit index), one on condition and something on category, would suffice.

There's no "preferred" quantity of indexes, everything is dependent in your queries. Inside your example, you'd need 3 indexes, one for ID, one for condition, and something for category.