On Fri, Aug 22, 2003 at 10:23:37AM -0400, Keith C. Ivey wrote:
> On 21 Aug 2003 at 21:38, Jesse Sheidlower wrote:
> 
> > Huh, I was told the exact opposite, that if most of the
> > entries are smaller than the maximum length of the field, you
> > should use an index about the size you expect most entries to
> > be. Why would you ever use a shorter index than the full column
> > length if it led to such performance degradation?
> 
> It depends on the query (as well as your data).  In your case, the 
> only column you're selecting is cw, so if all of cw is in the index 
> MySQL can use the index alone and never has to look at the data file. 
> That speeds things up quite a bit.  If you were selecting multiple 
> columns the difference might not be so great.
> 
> Another point is that you're sorting by cw, and a prefix-based index 
> won't allow you to sort completely.  If your queries were mainly 
> selecting by cw rather than sorting by it, a prefix-based index 
> should be fine.

Hmm. This is a single case; as mentioned in other queries one
might be selecting by other values, and I'd usually be
selecting multiple column. The sort, however, is always done
either on cg.cw, or on cit.d (which I may not have shown), a
date field.

Jesse Sheidlower

-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:    http://lists.mysql.com/[EMAIL PROTECTED]

Reply via email to