Greer, Darren (MED) writes:

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

Ah. That does make a difference. MySQL is of course
forced to go through all of your data, counting the
number of rows with status 'A'. I don't believe an
index would do you much good, since it'd add so much to
the size of the index file and slow down updates and
inserts. Is there any way you could just store that
number in another table, maybe? You'd have to update it
every time you insert or update the big table, but if
that's only done in a few places it should be doable.
If that won't work, but it's not important with perfect
accuracy, you could run that evil SELECT once a day or
however often you like, and cache the result.

//C

-- 
 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

Reply via email to