I have a table called data
in mysql database. The table is quite large and has about 500k records and this number will grow up to 1 million. Each record consists of about 50 columns and most of them contain varchars.
The data
table is being used very frequently. Actually, most queries access this table. The data is being read from and written to it by ~50 users simultaneously. The system is highly loaded with the users uploading and checking their data so it can be stopped maximum for an hour or two.
After some research. I found out that almost all the select queries that have 'where' clause use one of four fields in the table. That fields are: isActive, country, state, city - all are in the int format. The where can be either
where isActive = {0|1}
or
where isActive = {0|1} and {country|state|city} = {someIntValue}
or
where {country|state|city} = {someIntValue}
And the last thing is that the table does not have any indexes except for the primary id one.
After the table has grown to current sizes i faced some performance issues.
So, my question is if i create the indexes on the columns isActive, country, state and city will the performance increase?
UPD: I've just created an index on one of that fields and WOW! the queries are being executed immediately. Thank you, guys.