From: Tom Lane <tgl@sss.pgh.pa.us>
To: vaclav.juza@xitee.com
Cc: pgsql-bugs@postgresql.org
Subject: Re: BUG #7598: Loss of view performance after dump/restore of the view definition
Date: Fri, 12 Oct 2012 17:24:31 -0400
Message-ID: <22733.1350077071@sss.pgh.pa.us> (raw)
In-Reply-To: <E1TMGxP-0007Th-2h@wrigleys.postgresql.org>
References: <E1TMGxP-0007Th-2h@wrigleys.postgresql.org>
vaclav.juza@xitee.com writes:
> when a view (with the below properites) is dump and restored (no matter if
> using pg_dump, copied from pg_admin or using pg_views) it's performance is
> worse than before. The view was using tables with columns of type "character
> varying(xx)" and the dump inserts "::text" casts into the join conditions on
> these columns.
This is not the dump code's fault: those casts are legitimate, and
indeed present in the original view anyway. However, the planner was
having a problem with thinking that implicit and explicit casts weren't
equivalent. I've committed a fix into 9.2. I'm hesitant to change the
behavior further back than that, even though arguably this has been
broken since 8.3.
> In the real case we faced this problem, the performance loss was much higher
> on PostgreSQL 9.2.1 (3 seconds vs. 3 minutes) than on 9.1.4 (1.3 seconds vs.
> 7 seconds) and both variants were slower on 9.2.1 than on 9.1.4. In the test
> case below the behaviour is similar on both Postgres version.
It's difficult to tell whether there's any real issue here beyond that.
I sometimes get a noticeably slower plan out of HEAD, but sometimes I
don't, if I regenerate the random table contents. It looks to me like
the slower plans occur when it changes the join ordering, but that's
contingent on rowcount estimates that are equally awful in both versions;
the lvl = (SELECT max/min(lvl) ...) conditions are not estimated well by
any existing Postgres release. So I'm not inclined to ascribe a lot of
significance to the planner's choices here.
regards, tom lane
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-bugs@postgresql.org
Cc: tgl@sss.pgh.pa.us, vaclav.juza@xitee.com
Subject: Re: BUG #7598: Loss of view performance after dump/restore of the view definition
In-Reply-To: <22733.1350077071@sss.pgh.pa.us>
References: <E1TMGxP-0007Th-2h@wrigleys.postgresql.org> <22733.1350077071@sss.pgh.pa.us>
* 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