Re: How many colums should a index contain?

2006-11-04 Thread John . H
indexes on a table to optimise all of your queries. Sometimes this makes the indexes much larger than the data itself. Hope this helps, Andy > -Original Message- > From: Brent Baisley [mailto:[EMAIL PROTECTED] > Sent: 03 November 2006 16:04 > To: John.H; mysql > Subj

RE: How many colums should a index contain?

2006-11-03 Thread Andy Eastham
much larger than the data itself. Hope this helps, Andy > -Original Message- > From: Brent Baisley [mailto:[EMAIL PROTECTED] > Sent: 03 November 2006 16:04 > To: John.H; mysql > Subject: Re: How many colums should a index contain? > > I think you want to create separate

Re: How many colums should a index contain?

2006-11-03 Thread Brent Baisley
I think you want to create separate indexes. Indexes are basically a sorted list. So a single index on all those fields would sort the data first by id, then bid, then title,... If id is unique, then there is absolutely no reason to add other fields to the index. Think of a compound index as a f

Re: How many colums should a index contain?

2006-11-02 Thread Chris
John.H wrote: but why when I do a query with 'explain' ,it shows that the 'possible_keys' is null or primary rather than the index I just create Please always CC the list - you will get much faster responses and others will be able to offer their input as well. Post the query, the explain

Re: How many colums should a index contain?

2006-11-02 Thread Chris
John.H wrote: I have two tables and I must do : select `id`,`bid`,`title`,`link`,`bname` from table1 where `bid` in ( ...this is a subquery in table2 ) should I create a index (`id`,`bid`,`title`,`link`,`bname`) so that my query will take less time or should a index contain so many colums? I