Re: PostgreSQL Gotchas

From: "Jim C(dot) Nasby" <jnasby(at)pervasive(dot)com>
To: "Aly S(dot)P Dharshi" <aly(dot)dharshi(at)telus(dot)net>, "Gavin M(dot) Roy" <gmr(at)ehpg(dot)net>, pgsql-general(at)postgresql(dot)org
Subject: Re: PostgreSQL Gotchas
Date: 2005-10-06 22:24:31
Message-ID: 20051006222431.GO36108@pervasive.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Thu, Oct 06, 2005 at 04:18:03PM -0400, Stephen Frost wrote:
> COUNT(*) very slow
> As someone else has pointed out, it's only slow if you've got a large
> dataset. There's certainly workarounds for this issue (generally
> involving a couple of functions for keeping track of the number of
> rows). In this way, Postgres actually gives the user the flexibility
> to choose the performance loss on insert/deletes which is necessary to
> track the number of rows seperately, or not to.

Actually, I think the real issue here is that unlike every other
database I've used, PostgreSQL can't do covering index scans, where only
the index is read and not the base table. This is due to not having MVCC
visibility info in the index. But there has been discussion on -hackers
about a way to get close to this behavior; something along the lines of
setting a bit in the index once a tuple is visible to all running
transactions. This would be a win on larger indexes that don't have a
lot of insert/update/delete activity.
--
Jim C. Nasby, Sr. Engineering Consultant jnasby(at)pervasive(dot)com
Pervasive Software http://pervasive.com work: 512-231-6117
vcard: http://jim.nasby.net/pervasive.vcf cell: 512-569-9461

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Jim C. Nasby 2005-10-06 22:29:14 Re: PostgreSQL Gotchas
Previous Message Jim C. Nasby 2005-10-06 22:20:20 Re: PostgreSQL Gotchas