50.000 records, 2 values and 1.5 s to find out?!!
| From: | andy | Date: | Wed, 22 May 2002 16:45:51 +0000 |
| Subject: | 50.000 records, 2 values and 1.5 s to find out?!! | ||
| Groups: | php.db | ||
| Request: | Send a blank email to php-db+get-19363@lists.php.net to get a copy of this message | ||
Hi there,
I have a user table, containing a column on gender. Type is tinyint(1) and 1
is male 2 is female. No index. 50000 entries
This statement:
SELECT sex, count(*) AS c
FROM user GROUP BY sex
takes 1.5 s to execute
I am wondering if ti wuold be possible to find this out any faster ?
SELECT count(*) AS c
FROM .user
where sex = 1
takes about half the time :-)
So maybe some of you guys do have some experiance on that. This is just way
to long.
I appreciate every help on that,
Thanx in advance, Andy