If I move the status to another table, and then wanted to get a count of
everyone who is of status 'A', how would that be any quicker?  Would I
join the tables?

-----Original Message-----
From: Carl Troein [mailto:[EMAIL PROTECTED]] 
Sent: Tuesday, January 08, 2002 11:34 AM
To: [EMAIL PROTECTED]
Subject: Re: General Query time question



I didn't think/read far enough. One more attempt is due.

> > Correction on the query: SELECT count(*) as count FR
> OM userdata WHERE
> > status = 'A';

I didn't see that it was on that column you had an index,
so forget I said 'of course'. Have you used EXPLAIN to
figure out if the index is actually used in the query?

If you haven't already, consider running an ANALYZE TABLE
just so MySQL can get some idea of the distribution for the indexed
columns. It might help the optimizer make a better decision if it's not
already doing what's best. If the status column only has a few different
values, an index will not be used because the overhead of using the
index will be greater than the benefit. If this is the case, you'll be
better off without the index, and you could consider one of the two
options I rambled about in my previous mail.

//C - sorry 'bout that.

-- 
 Carl Troein - Círdan / Istari-PixelMagic - UIN 16353280
[EMAIL PROTECTED] | http://pixelmagic.dyndns.org/~cirdan/
 Amiga user since '89, and damned proud of it too.


---------------------------------------------------------------------
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/           (the list archive)

To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail
<[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php

---------------------------------------------------------------------
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/           (the list archive)

To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php

Reply via email to