Hi,
For a future databas, I plan to have got a table with a text field
which can contain only three different values, say "VALUE1",
"VALUE2", and "VALUE3"
this table may have, over the course of one year, several million
rows for a size around 2 Gb or more.
I'd be interested in having :
SELECT count(*) AS nbvalue1 FROM mytable WHERE myfield='VALUE1'; SELECT count(*) AS nbvalue2 FROM mytable
WHEREmyfield='VALUE2'; SELECT count(*) AS nbvalue3 FROM mytable WHERE myfield='VALUE3';
be as fast as possible.
considering that almost 70% of the rows will be with 'VALUE1', 20%
will be with 'VALUE2' and 10% will be with 'VALUE3' on the average.
should I create an index to speedup the counts or not ?
any idea of the impact of running these three queries every 5 minutes
on say 10 000 000 rows ?
thanks in advance
Jerome Alet