> > 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 ...)

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

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

---------------------------(end of broadcast)---------------------------
TIP 6: Have you searched our list archives?


Reply via email to