From: Willem Leenen <willem_leenen@hotmail.com>
To: tgl@sss.pgh.pa.us
To: pg@fastcrypt.com
Cc: pgsql-performance@postgresql.org
Subject: Re: performance regression with 9.2
Date: Mon, 12 Nov 2012 21:13:46 +0000
Message-ID: <DUB104-W27CF42182896D194898D798F6D0@phx.gbl> (raw)
In-Reply-To: <5518.1352753033@sss.pgh.pa.us>
References: <CADK3HHKA-JAs1Bno4=_956NnAoNZars60qU0PBiX7-gOnWnEaQ@mail.gmail.com>
<5518.1352753033@sss.pgh.pa.us>
Hello Tom,
Could you elaborate on this? I'm trying to learn the explain plans of postgresql and i would like to know if we're looking at the same clue's.
To me, i see a mismatch between the optimizer and the actual records retrieved in the fast SQL as well, so plan instability is a realistic scenario. For the slow query, I thought to see a problem in the part below the ' recursive union' :
the HASH join is more expensive that the nested loop. ( hints are not yet implemented in Postgresql , aren't they? )
So the SQL text is:
explain analyze
SELECT
note_sets."id" AS t0_r0,
...
notes."updated_by" AS t2_r10
FROM
note_sets
LEFT OUTER JOIN note_set_sources ON note_set_sources.id = note_sets.note_set_source_id
LEFT OUTER JOIN notes ON notes.note_set_id = note_sets.id AND
notes."status" = E'A'
WHERE
(note_sets.id IN (WITH RECURSIVE parent_noteset as
(SELECT id FROM note_sets where id = 8304085
UNION
SELECT note_sets.id FROM
parent_noteset parent_noteset,
note_sets note_sets
WHERE note_sets.parent_id = parent_noteset.id) SELECT id FROM parent_noteset))
IMHO, the plan goes wrong at the part
SELECT note_sets.id FROM
parent_noteset parent_noteset,
note_sets note_sets
WHERE note_sets.parent_id = parent_noteset.id)
Do you agree?
> From: tgl@sss.pgh.pa.us
> To: pg@fastcrypt.com
> CC: pgsql-performance@postgresql.org
> Subject: Re: [PERFORM] performance regression with 9.2
> Date: Mon, 12 Nov 2012 15:43:53 -0500
>
> Dave Cramer <pg@fastcrypt.com> writes:
> > This query is a couple orders of magnitude slower the first result is
> > 9.2.1, the second 9.1
>
> Hm, the planner's evidently doing the wrong thing inside the recursive
> union, but not obvious why. Can you extract a self-contained test case?
>
> regards, tom lane
>
>
> --
> Sent via pgsql-performance mailing list (pgsql-performance@postgresql.org)
> To make changes to your subscription:
> http://www.postgresql.org/mailpref/pgsql-performance =
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-performance@postgresql.org
Cc: willem_leenen@hotmail.com, tgl@sss.pgh.pa.us, pg@fastcrypt.com
Subject: Re: performance regression with 9.2
In-Reply-To: <DUB104-W27CF42182896D194898D798F6D0@phx.gbl>
References: <CADK3HHKA-JAs1Bno4=_956NnAoNZars60qU0PBiX7-gOnWnEaQ@mail.gmail.com> <5518.1352753033@sss.pgh.pa.us> <DUB104-W27CF42182896D194898D798F6D0@phx.gbl>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox