pg.ddx.io  pgsql-performance@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Harald Lau (Sector-X) <harald@sector-x.de>
To: pgsql-performance@postgresql.org
Subject: Re: no index-usage on aggregate-functions?
Date: Tue, 29 Jun 2004 10:46:27 +0200
Message-ID: <00b801c45db5$914330e0$6602a8c0@spock> (raw)
References: <007d01c45da4$3726dcd0$6602a8c0@spock>
	<40E11BF0.3020109@familyhealth.com.au>

@Chris:

> > SELECT count(*) FROM the_table
> > => Seq scan -> takes about 12 sec
> This cannot be made O(1) in postgres due to MVCC.  You just have to live 
> with it.

bad news
BTW: in this case you could workaround
select reltuples from pg_class where relname='the_table'
(yes, I know: presumes a regular vacuum analyse)

> Average and sum can never use an index AFAIK, in any db server.  You 
> need information from every row.

Take a look at the SQLSrv-pendant:
create index x_1 on the_table (num_found)
select avg(num_found) from the_table
-> Index Scan(OBJECT:([midata].[dbo].[THE_TABLE].[x_1])

(I'm not sure what Oracle does - have to re-install it first ...)


@Scott:
> Yes, you're expecting an MVCC database to behave like a row locking
> database.

hmmmm...
So, it seems that PG is not soooo well suited for a datawarehouse and/or performing extensive statistics/calculations/reportings on large tables, is it?

Greetings Harald



view thread (8+ messages)  latest in thread

Message-ID: <00b801c45db5$914330e0$6602a8c0@spock>
Permalink:  ../00b801c45db5$914330e0$6602a8c0@spock/
Also on:    postgresql.org/message-id/00b801c45db5$914330e0$6602a8c0@spock

 · 

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: harald@sector-x.de
  Subject: Re: no index-usage on aggregate-functions?
  In-Reply-To: <00b801c45db5$914330e0$6602a8c0@spock>

* 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