Re: Database performance problem

From: Steve Crawford <scrawford(at)pinpointresearch(dot)com>
To: "Porell, Chris" <Chris(dot)Porell(at)ceridian(dot)com>
Cc: "'pgsql-general(at)postgresql(dot)org'" <pgsql-general(at)postgresql(dot)org>
Subject: Re: Database performance problem
Date: 2007-06-12 20:09:11
Message-ID: 466EFD67.9060006@pinpointresearch.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Porell, Chris wrote:
> ... I snagged a SELECT from one of the reports. It is a
> fairly complex query with 4 joins, which unfortunately I can't share. I can
> say that the plan for the query on both machines looks nearly identical -
> that is there are no sequential scans happening on the old DB server that
> aren't also happening on the new server.

Did you use "EXPLAIN" or "EXPLAIN ANALYZE"?

EXPLAIN alone just shows the plan - it doesn't run the query.

EXPLAIN ANALYZE runs the query and reports time actually spent at each
step. This should tell you if there is a particular part of the query
that is causing the problems.

NOTE! EXPLAIN ANALYZE executes the query, discards the result, and shows
the timing information. If the query modifies the database, those
modifications will still happen. In this case the manual recommends
wrapping the statement;
BEGIN;
EXPLAIN ANALYZE ...;
ROLLBACK;

Cheers,
Steve

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Tom Lane 2007-06-12 20:18:38 Re: Date style handling changes between 7.4.12 and 8.2.4
Previous Message Jasbinder Singh Bali 2007-06-12 19:49:26 Foreign Key error