MySQL Forums
Forum List  »  Newbie

Re: indexing on every column?
Posted by: Ben Hunter
Date: November 19, 2009 09:29PM

Indexes wont help you with the select portion (someone correct me if I'm wrong on that) so the fact that they can query any combination of rows shouldn't affect your indexing decisions (I guess the exception is if you only ask for columns that are part of the index you are using, but it doesn't seem useful here). You want indexes on columns that are common in the where portion of your queries, group by's, and order by's. Though there are plenty of posts out there I'm sure with solid, general information on how to choose indexes...based on what you said, it sounds like the only fields in the where clause are the date field(s), and you sort on starting_time.

Since starting_time is the only date field in your schema, I think you should start out indexing on that. Be sure to use the BTREE if you use ranges. Given a date range, and an order on the same date field, mysql should be able to narrow down your rows relatively quickly, and may have them sorted already in the index. Hopefully this should pick up performance.

Options: ReplyQuote


Subject
Written By
Posted
November 19, 2009 07:06AM
November 19, 2009 07:09PM
Re: indexing on every column?
November 19, 2009 09:29PM
November 20, 2009 02:17AM
November 20, 2009 07:11AM
November 20, 2009 07:17AM
November 20, 2009 10:42AM
November 22, 2009 01:38PM
November 22, 2009 04:13PM


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.