Reputation: 15934
I have a table that holds stats for a game, this table will have hundreds of thousands of lines in but i need to it be searchable for the stats pages of the game.
I am not sure what I need to do regarding indexing and how to keep the table searchable in a realistic time. I normally index the Id field which is a primary key. I don't really understand indexing so am not sure if I am doing the correct thing.
Can anyone lend some advice please? I am using a MySQL database.
Thanks.
Upvotes: 1
Views: 3798
Reputation: 499012
Rule of thumb - index columns that you are using in the WHERE
clause and those being used in the ORDER BY
.
You should always, however, test the effects of the change - sometimes adding indexes can cause performance problems.
I suggest reading one of the many tutorials on optimizing mysql and following the advice with your table.
Upvotes: 9