Performing a count(*) on a large table, how to optimize

Поиск
Список
Период
Сортировка
От Martin Weinberg
Тема Performing a count(*) on a large table, how to optimize
Дата
Msg-id 199904151506.LAA08377@osprey.phast.umass.edu
обсуждение исходный текст
Список pgsql-general
PG folks,

I have 5 Gb table (mostly numerical values) and want to be able to
count sources in a range of values, e.g.:

      select count(*) from mytable where x between 1.0 and 2.0;

I have indexed on x and vacuumed.

I notice that these take about 3 minutes on my 450 Xeon Linux box.
A very complicated where clause returning data etc. takes about
the same time.

Is there a way to optimize this type of query?

Thanks!

--M

===========================================================================

Martin Weinberg                      Phone: (413) 545-3821
Dept. of Physics and Astronomy       FAX:   (413) 545-2117/0648
530 Graduate Research Tower
University of Massachusetts
Amherst, MA  01003-4525


В списке pgsql-general по дате отправления:

Предыдущее
От: darold
Дата:
Сообщение: The WWW of PostgreSQL
Следующее
От: Michael J Davis
Дата:
Сообщение: RE: [GENERAL] case problem with MS Access export