Slow response of PostgreSQL - Mailing list pgsql-performance

From Saleem Burhani Baloch
Subject Slow response of PostgreSQL
Date
Msg-id 200402170624.i1H6O2u16022@ns2.khi.wol.net.pk
Whole thread Raw
Responses Re: Slow response of PostgreSQL  (Christopher Kings-Lynne <chriskl@familyhealth.com.au>)
Re: Slow response of PostgreSQL  (Stephan Szabo <sszabo@megazone.bigpanda.com>)
Re: Slow response of PostgreSQL  (Tom Lane <tgl@sss.pgh.pa.us>)
Re: Slow response of PostgreSQL  ("scott.marlowe" <scott.marlowe@ihs.com>)
List pgsql-performance
Hello,

I m checking Postgresql and MS-SQl database server for our new development. On a very first query Postresql is out
performedand I think it is very disappointing. My query consists on a single table only on both machines. 

Table Structure
                    Table "inv_detail"
  Attribute   |         Type          |      Modifier
--------------+-----------------------+--------------------
 inv_no       | integer               | not null
 unit_id      | character(4)          | not null
 item         | character varying(90) | not null
 qty          | double precision      | not null default 0
 rate         | double precision      | not null default 0
 unit         | character varying(20) | not null
 vl_ex_stax   | double precision      | not null default 0
 stax_prc     | double precision      | not null default 0
 adl_stax_prc | double precision      | not null default 0
 package      | character varying(12) |

Having 440,000 Records.

My Query
--------
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.

MS-SQL Machine
**************
Athlon 600Mhz. (Unbranded)
256 MB Ram. ( 133 Mhz)
40 GB Baracude NTFS File System.
Windows 2000 Server Enterprise.
MS-SQL 2000 Enterprise. (Default Settings)

PostgreSQL Machine
******************
P-III 600Mhz (Dell Precision 220)
256 MB Ram (RD Ram)
40 GB Baracuda Ext2 File System.
RedHat 7.2
PostgreSQL 7.1.3-2

My PostgreSQL Conf is
*********************
log_connections = yes
syslog = 2
effective_cache_size = 327680
sort_mem = 10485760
max_connections = 64
shared_buffers = 512
wal_buffers = 1024

NOTICE:  QUERY PLAN:
********************
Aggregate  (cost=inf..inf rows=44000 width=28)
  ->  Group  (cost=inf..inf rows=440000 width=28)
        ->  Sort  (cost=inf..inf rows=440000 width=28)
              ->  Seq Scan on inv_detail  (cost=0.00..11747.00 rows=440000 width=28)
EXPLAIN

Even if I dont compare postgres with any other database server the time taken is alarmingly high. These settings are
notgood I know, but the Postgres result is very un-acceptable. I m looking forward for comments to change the conf
settingfor acceptable results. 

And I have two more questions :

1- How can I lock a single record so that other users can only read it. ??
2- one user executes a query it will be process and when another user executes the same query having the same result
shouldnot again go for processing. The result should be come from the cache. Is this possible in postgres ?? 


Saleem

pgsql-performance@postgresql.org



pgsql-performance by date:

Previous
From: David Teran
Date:
Subject: Re: select max(id) from aTable is very slow
Next
From: Christopher Kings-Lynne
Date:
Subject: Re: Slow response of PostgreSQL