pg.ddx.io  pgsql-performance@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Cestmir Hybl <cestmirl@freeside.sk>
To: hubert depesz lubaczewski <depesz@gmail.com>
Cc: pgsql-performance@postgresql.org
Subject: Re: count(*) using index scan in "query often, update rarely" environment
Date: Fri, 7 Oct 2005 12:14:29 +0200
Message-ID: <9d5b01c5cb27$e7a1c970$131fc39e@stratos> (raw)
References: <935801c5cb20$dcf93a00$131fc39e@stratos>
	<9e4684ce0510070254v67e08bcfhb725715803a5de25@mail.gmail.com>

Yes, I can possibly use triggers to maintanin counts of several fixed groups of records or total recordcount (but it's unpractical).

No, I can't speed-up evaluation of generic "count(*) where ()" queries this way.

My question was rather about general performance of count() queries in environment with infrequent updates.

Cestmir
  ----- Original Message ----- 
  From: hubert depesz lubaczewski 
  To: Cestmir Hybl 
  Cc: pgsql-performance@postgresql.org 
  Sent: Friday, October 07, 2005 11:54 AM
  Subject: Re: [PERFORM] count(*) using index scan in "query often, update rarely" environment


  On 10/7/05, Cestmir Hybl <cestmirl@freeside.sk> wrote:
    Isn't it possible (and reasonable) for these environments to keep track of whether there is a transaction in progress with update to given table and if not, use an index scan (count(*) where) or cached value (count(*)) to perform this kind of query?

  if i understand your problem correctly, then simple usage of triggers will do the job just fine.

  hubert

view thread (11+ messages)  latest in thread

Message-ID: <9d5b01c5cb27$e7a1c970$131fc39e@stratos>
Permalink:  ../9d5b01c5cb27$e7a1c970$131fc39e@stratos/
Also on:    postgresql.org/message-id/9d5b01c5cb27$e7a1c970$131fc39e@stratos

 · 

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: cestmirl@freeside.sk, depesz@gmail.com
  Subject: Re: count(*) using index scan in "query often, update rarely" environment
  In-Reply-To: <9d5b01c5cb27$e7a1c970$131fc39e@stratos>

* 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