Re: count * performance issue

Поиск
Список
Период
Сортировка
Искать
От
A. Kretschmer
Тема
Re: count * performance issue
Дата
Msg-id
20080306060829.GA21084@a-kretschmer.de
Ответ на
Список
Дерево обсуждения
Re: Benchmark: Dell/Perc 6, 8 disk RAID 10 "justin" <justin@emproshunts.com>
Re: Benchmark: Dell/Perc 6, 8 disk RAID 10 "Scott Marlowe" <scott.marlowe@gmail.com>
Re: Benchmark: Dell/Perc 6, 8 disk RAID 10 Jesper Krogh <jesper@krogh.cc>
Re: Benchmark: Dell/Perc 6, 8 disk RAID 10 "Scott Marlowe" <scott.marlowe@gmail.com>
Re: Benchmark: Dell/Perc 6, 8 disk RAID 10 Jesper Krogh <jesper@krogh.cc>
Re: Benchmark: Dell/Perc 6, 8 disk RAID 10 Justin <justin@emproshunts.com>
Re: Benchmark: Dell/Perc 6, 8 disk RAID 10 Greg Smith <gsmith@gregsmith.com>
Re: Benchmark: Dell/Perc 6, 8 disk RAID 10 Justin <justin@emproshunts.com>
Re: Benchmark: Dell/Perc 6, 8 disk RAID 10 Justin <justin@emproshunts.com>
Re: Benchmark: Dell/Perc 6, 8 disk RAID 10 Dave Cramer <pg@fastcrypt.com>
Re: Benchmark: Dell/Perc 6, 8 disk RAID 10 Craig James <craig_james@emolecules.com>
Re: Benchmark: Dell/Perc 6, 8 disk RAID 10 Michael Stone <mstone+postgres@mathom.us>
Re: Benchmark: Dell/Perc 6, 8 disk RAID 10 Dave Cramer <pg@fastcrypt.com>
Re: Benchmark: Dell/Perc 6, 8 disk RAID 10 Justin <justin@emproshunts.com>
Re: Benchmark: Dell/Perc 6, 8 disk RAID 10 Craig Ringer <craig@postnewspapers.com.au>
Re: Benchmark: Dell/Perc 6, 8 disk RAID 10 Justin <justin@emproshunts.com>
Re: Benchmark: Dell/Perc 6, 8 disk RAID 10 Tino Wildenhain <tino@wildenhain.de>
Re: Benchmark: Dell/Perc 6, 8 disk RAID 10 "Andrej Ricnik-Bay" <andrej.groups@gmail.com>
Re: Benchmark: Dell/Perc 6, 8 disk RAID 10 "Scott Marlowe" <scott.marlowe@gmail.com>
Re: Benchmark: Dell/Perc 6, 8 disk RAID 10 Craig James <craig_james@emolecules.com>
Re: Benchmark: Dell/Perc 6, 8 disk RAID 10 Justin <justin@emproshunts.com>
Re: Benchmark: Dell/Perc 6, 8 disk RAID 10 Dave Cramer <pg@fastcrypt.com>
Re: Benchmark: Dell/Perc 6, 8 disk RAID 10 Justin <justin@emproshunts.com>
Re: Benchmark: Dell/Perc 6, 8 disk RAID 10 Craig James <craig_james@emolecules.com>
Re: Benchmark: Dell/Perc 6, 8 disk RAID 10 Justin <justin@emproshunts.com>
Re: Benchmark: Dell/Perc 6, 8 disk RAID 10 James Mansion <james@mansionfamily.plus.com>
Re: Benchmark: Dell/Perc 6, 8 disk RAID 10 Enrico Sirola <enrico.sirola@gmail.com>
Re: Benchmark: Dell/Perc 6, 8 disk RAID 10 "Scott Marlowe" <scott.marlowe@gmail.com>
Re: Benchmark: Dell/Perc 6, 8 disk RAID 10 "Scott Marlowe" <scott.marlowe@gmail.com>
am  Thu, dem 06.03.2008, um 11:13:01 +0530 mailte sathiya psql folgendes:
> count(*) tooks much time...
> 
> but with the where clause we can make this to use indexing,... what where
> clause we can use??

An index without a WHERE can't help to avoid a seq. scan.


> 
> Am using postgres 7.4 in Debian OS with 1 GB RAM,

PG 7.4 are very old... Recent versions are MUCH faster.



> 
> am having a table with nearly 50 lakh records,
> 
> it has more than 15 columns, i want to count how many records are there, it is
> taking nearly 17 seconds to do that...
> 
> i know that to get a approximate count we can use
>          SELECT reltuples FROM pg_class where relname = TABLENAME;
> 
> but this give approximate count, and i require exact count...

There aren't a general solution. If you realy need the exact count of
tuples than you can play with a TRIGGER and increase/decrease the
tuple-count for this table in an extra table.


Andreas
-- 
Andreas Kretschmer
Kontakt:  Heynitz: 035242/47150,   D1: 0160/7141639 (mehr: -> Header)
GnuPG-ID:   0x3FFF606C, privat 0x7F4584DA   http://wwwkeys.de.pgp.net
В списке pgsql-performance по дате отправления
От: petchimuthu lingam
Дата:
От: RaviRam Kolipaka
Дата:
FAQ