Re: postgresql is slow with larger table even it is in RAM

From: Craig Ringer <craig(at)postnewspapers(dot)com(dot)au>
To: depesz(at)depesz(dot)com
Cc: sathiya psql <sathiya(dot)psql(at)gmail(dot)com>, pgsql-performance(at)postgresql(dot)org
Subject: Re: postgresql is slow with larger table even it is in RAM
Date: 2008-03-25 09:34:35
Message-ID: 47E8C72B.2010105@postnewspapers.com.au
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-performance

hubert depesz lubaczewski wrote:
> On Tue, Mar 25, 2008 at 02:05:20PM +0530, sathiya psql wrote:
>> Any Idea on this ???
>
> yes. dont use count(*).
>
> if you want whole-table row count, use triggers to store the count.
>
> it will be slow. regeardless of whether it's in ram or on hdd.

In other words, if you're having performance problems please provide
EXPLAIN ANALYZE output from a more useful query that does real work,
rather than something like count(*).

COUNT(*) can be slow due to some MVCC limitations; it's been discussed
frequently here so you should search the archives for information.

--
Craig Ringer

In response to

Browse pgsql-performance by date

  From Date Subject
Next Message sathiya psql 2008-03-25 11:42:02 what is the maximum number of rows in a table in postgresql 8.1
Previous Message hubert depesz lubaczewski 2008-03-25 09:08:23 Re: postgresql is slow with larger table even it is in RAM