MySQL Forums
Forum List  »  Newbie

Question about indexes
Posted by: Love MySQL
Date: January 29, 2014 11:08PM

I have only been working with mysql for a few years. I developed a web app that over the course of the last few years has grown considerable. Now I find myself going back and re-working bad programming because my server is getting bogged down as the database grows.

Anyway, none of my tables had indexes up to a few days ago. I finally got around to adding a slow-log and realized I had many queries taking over 1 second. I researched and starting adding queries where necessary which cut down considerably on my slow-log.

But I have reached a point where I am not sure how to proceed. I have a table which holds user data. One column is the userid, this is my index right now.

The other columns:
month
day
year
a couple varchar columns that could be anything
a couple float columns that could be anything
3 columns that are 1/0 flag type

I am still getting a few UPDATE queries from this table that are in my slow-log (which I bumped down to 0.5 seconds)

I am still confused about indexes... should I add another index to this table? I guess the next best index would be the year... but I am not sure.

How many indexes should a table have? Is the only downside to having more indexes that it takes up more space?

Thanks for anyhelp.

Options: ReplyQuote


Subject
Written By
Posted
Question about indexes
January 29, 2014 11:08PM
January 30, 2014 12:01AM
January 30, 2014 12:26AM
January 30, 2014 06:38AM
January 31, 2014 10:40AM
January 31, 2014 05:31PM
January 31, 2014 07:12PM
January 31, 2014 07:59PM
January 31, 2014 10:14PM
February 01, 2014 09:41AM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.