From: Josh Berkus <josh@agliodbs.com>
To: pgsql-performance@postgresql.org
Subject: 8.4/9.0 simple query performance regression
Date: Mon, 06 Jun 2011 14:45:43 -0700
Message-ID: <4DED4A87.7000901@agliodbs.com> (raw)
All,
Just got this simple case off IRC today:
8.4.4
This plan completes in 100ms:
old_prod=# explain analyze select email from u_contact where id not in
(select contact_id from u_user);
QUERY PLAN
--------------------------------------------------------------------------------------------------------------------
Seq Scan on u_contact (cost=2217.72..4759.74 rows=35560 width=22)
(actual time=61.283..107.169 rows=4521 loops=1)
Filter: (NOT (hashed SubPlan 1))
SubPlan 1
-> Seq Scan on u_user (cost=0.00..2051.38 rows=66538 width=8)
(actual time=0.034..33.303 rows=66978 loops=1)
Total runtime: 108.001 ms
9.0.2
This plan does not complete in 15 minutes or more:
new_prod=# explain select email from u_contact where id not in (select
contact_id from u_user);
QUERY PLAN
---------------------------------------------------------------------------
Seq Scan on u_contact (cost=0.00..100542356.74 rows=36878 width=22)
Filter: (NOT (SubPlan 1))
SubPlan 1
-> Materialize (cost=0.00..2552.56 rows=69504 width=8)
-> Seq Scan on u_user (cost=0.00..1933.04 rows=69504 width=8)
(5 rows)
I'm at a bit of a loss as to what's happening here. I'd guess another
failure of a bail-out-early plan, but I can't see how that would work
with this query.
--
Josh Berkus
PostgreSQL Experts Inc.
http://pgexperts.com
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 using the --to and --cc options:
reply via email
To: pgsql-performance@postgresql.org
Cc: josh@agliodbs.com
Subject: Re: 8.4/9.0 simple query performance regression
In-Reply-To: <4DED4A87.7000901@agliodbs.com>
* 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