Re: Database performance problem - Mailing list pgsql-general

From Steve Crawford
Subject Re: Database performance problem
Date
Msg-id 466EFD67.9060006@pinpointresearch.com
Whole thread Raw
In response to Database performance problem  ("Porell, Chris" <Chris.Porell@ceridian.com>)
List 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

pgsql-general by date:

Previous
From: "Jasbinder Singh Bali"
Date:
Subject: Foreign Key error
Next
From: Tom Lane
Date:
Subject: Re: Date style handling changes between 7.4.12 and 8.2.4