pg.ddx.io  pgsql-performance@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Craig Ringer <craig@postnewspapers.com.au>
To: depesz@depesz.com
Cc: sathiya psql <sathiya.psql@gmail.com>
Cc: pgsql-performance@postgresql.org
Subject: Re: postgresql is slow with larger table even it is in RAM
Date: Tue, 25 Mar 2008 18:34:35 +0900
Message-ID: <47E8C72B.2010105@postnewspapers.com.au> (raw)
In-Reply-To: <20080325090823.GA5431@depesz.com>
References: <f966c2ee0803250135h57ba1d5bs41f77616ae7186dc@mail.gmail.com>
	<20080325090823.GA5431@depesz.com>

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



view thread (13+ messages)  latest in thread

Message-ID: <47E8C72B.2010105@postnewspapers.com.au>
Permalink:  ../47E8C72B.2010105@postnewspapers.com.au/
Also on:    postgresql.org/message-id/47E8C72B.2010105@postnewspapers.com.au

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-performance@postgresql.org
  Cc: craig@postnewspapers.com.au, depesz@depesz.com, sathiya.psql@gmail.com
  Subject: Re: postgresql is slow with larger table even it is in RAM
  In-Reply-To: <47E8C72B.2010105@postnewspapers.com.au>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox