Re: 7.3.1 New install, large queries are slow - Mailing list pgsql-performance

From Hannu Krosing
Subject Re: 7.3.1 New install, large queries are slow
Date
Msg-id 1042663379.1951.1.camel@rh72.home.ee
Whole thread Raw
In response to 7.3.1 New install, large queries are slow  ("Roman Fail" <rfail@posportal.com>)
List pgsql-performance
Roman Fail kirjutas K, 15.01.2003 kell 23:00:
> I am trying to get a PostgreSQL server into production (moving from MSSQL2K) but having some serious performance
issues. PostgreSQL is new to me, and I'm only just now comfortable with Linux.  So far I've succesfully compiled
postgresfrom source and migrated all the data from MSSQL.  Postgres is primarily accessed using JDBC.   
>
> I really want to use Postgres for production, but if I can't get better results out of it by the end of the week we
aredropping it forever and going back to MSSQL despite the $$$.  I'm basically at a point where I've got to find help
fromthe list.  Please help me make this server fly! 
>
> I have a query that does many joins (including two very big tables) which is slow on Postgres.  On PGSQL the query
takes19 minutes, but only 3 seconds on MSSQL.  The two servers have the same indexes created (including primary key
indexes). I finally gave up on creating all the foreign keys in Postgres - after 12 hours of 100% CPU.  It's hard for
meto believe that the hardware is the bottleneck - the $20k Postgres server far outclasses the MSSQL server (see below
forstats).  When I ran EXPLAIN ANALYZE for this query the CPU averaged 5%, sar -b shows about 6,000 block reads/sec,
andvmstat had zero swapping.  EXPLAIN results are below, I'm not sure how to interpret them. 
>

Two questions:

1) Have you run analyze on this database (after loading the data ?)

2) could you also post the actual query - it would make interpreting the
EXPLAIN ANALYZE RESULTS easier.

--
Hannu Krosing <hannu@tm.ee>

pgsql-performance by date:

Previous
From: Josh Berkus
Date:
Subject: Re: complicated queries in pl/pgsql
Next
From: "Roman Fail"
Date:
Subject: Re: 7.3.1 New install, large queries are slow