Re: [PERFORM] select max(id) from aTable is very slow

2004-02-16 Thread Nick Barr
David Teran wrote: Hi, we have a table with about 6.000.000 rows. There is an index on a column with the name id which is an integer and serves as primary key. When we execute select max(id) from theTable; it takes about 10 seconds. Explain analyze returns: -

Re: [PERFORM] select max(id) from aTable is very slow

2004-02-16 Thread Nick Barr
Nick Barr wrote: David Teran wrote: Hi, we have a table with about 6.000.000 rows. There is an index on a column with the name id which is an integer and serves as primary key. When we execute select max(id) from theTable; it takes about 10 seconds. Explain analyze returns: ---

Re: [PERFORM] select max(id) from aTable is very slow

2004-02-16 Thread David Teran
Hi Nick, Try using: SELECT id FROM theTable ORDER BY is DESC LIMIT 1; Using COUNT, MAX, MIN and any aggregate function on the table of that size will always result in a sequential scan. There is currently no way around it although there are a few work arounds. See the following for more infor

[PERFORM] Slow response of PostgreSQL

2004-02-16 Thread Saleem Burhani Baloch
Hello, I m checking Postgresql and MS-SQl database server for our new development. On a very first query Postresql is out performed and I think it is very disappointing. My query consists on a single table only on both machines. Table Structure Table "inv_detail" Attribute

Re: [PERFORM] Slow response of PostgreSQL

2004-02-16 Thread Christopher Kings-Lynne
select count(*), sum(vl_ex_stax) , sum(qty) , unit from inv_detail group by unit; on both databases. PostgreSQL return result in 50 sec every time. MS-SQL return result in 2 sec every time. My PostgreSQL Conf is * log_connections = yes syslog = 2 effective_cache_size = 327

Re: [PERFORM] Slow response of PostgreSQL

2004-02-16 Thread Tom Lane
"Saleem Burhani Baloch" <[EMAIL PROTECTED]> writes: > PostgreSQL 7.1.3-2 Aside from the config issues Chris mentioned, I'd recommend trying a somewhat less obsolete version of Postgres. I believe the poor performance with grouped aggregates should be fixed in 7.4 and later. (Red Hat 7.2 is a bit