Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1VEFR1-00064r-Rm for pgsql-performance@arkaria.postgresql.org; Tue, 27 Aug 2013 09:19:36 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.80) (envelope-from ) id 1VEFR1-0004or-C5 for pgsql-performance@arkaria.postgresql.org; Tue, 27 Aug 2013 09:19:35 +0000 Received: from makus.postgresql.org ([2001:4800:7903:4::125]) by malur.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1VEFR0-0004ol-G3 for pgsql-performance@postgresql.org; Tue, 27 Aug 2013 09:19:34 +0000 Received: from mail-out2.uio.no ([2001:700:100:10::58]) by makus.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1VEFQw-0000nc-Fs for pgsql-performance@postgresql.org; Tue, 27 Aug 2013 09:19:33 +0000 Received: from mail-mx3.uio.no ([129.240.10.44]) by mail-out2.uio.no with esmtp (Exim 4.75) (envelope-from ) id 1VEFQu-0002nh-5D for pgsql-performance@postgresql.org; Tue, 27 Aug 2013 11:19:28 +0200 Received: from bbking.uio.no ([129.240.6.205]) by mail-mx3.uio.no with esmtpsa (TLSv1:DHE-RSA-AES256-SHA:256) user rafael (Exim 4.80) (envelope-from ) id 1VEFQt-00083E-Lh for pgsql-performance@postgresql.org; Tue, 27 Aug 2013 11:19:28 +0200 Message-ID: <521C6F1F.5070901@usit.uio.no> Date: Tue, 27 Aug 2013 11:19:27 +0200 From: Rafael Martinez Organization: University of Oslo User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130806 Thunderbird/17.0.8 MIME-Version: 1.0 To: pgsql-performance@postgresql.org Subject: Re: SQL statement over 500% slower with 9.2 compared with 9.1 References: <521B4B2A.5010800@usit.uio.no> In-Reply-To: <521B4B2A.5010800@usit.uio.no> X-Enigmail-Version: 1.5.2 Content-Type: text/plain; charset=ISO-8859-15 Content-Transfer-Encoding: 7bit X-UiO-Ratelimit-Test: rcpts/h 1 msgs/h 1 sum rcpts/h 2 sum msgs/h 1 total rcpts 1664 max rcpts/h 23 ratelimit 0 X-UiO-Spam-info: not spam, SpamAssassin (score=-7.3, required=5.0, autolearn=disabled, FS_LARGE_PERCENT2=2.645, RP_MATCHES_RCVD=-1.94, UIO_MAIL_IS_INTERNAL=-5, UIO_PGP_SIGNED=-3, uiobl=NO, uiouri=NO) X-UiO-Scanned: 2CC7811955C5A5324493FFD636D425887104CCAD X-UiO-SPAM-Test: remote_host: 129.240.6.205 spam_score: -72 maxlevel 80 minaction 2 bait 0 mail/h: 1 total 1688 max/h 23 blacklist 0 greylist 0 ratelimit 0 X-Pg-Spam-Score: -2.4 (--) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-performance Precedence: bulk Sender: pgsql-performance-owner@postgresql.org -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 On 08/26/2013 02:33 PM, Rafael Martinez wrote: [............] > The SQL statement is: > > SELECT firstname || ' ' || lastname AS Name FROM Person R WHERE > R.gender like 'F' AND 19 < (SELECT COUNT(DISTINCT filmId) FROM > FilmParticipation F WHERE F.partType = 'director' AND F.personId = > R.personId ) AND NOT EXISTS ( SELECT * FROM > FilmParticipation D WHERE D.partType = 'director' AND D.personId > = R.personId AND NOT EXISTS ( SELECT * FROM FilmParticipation > C WHERE C.partType = 'cast' AND C.filmId = D.filmId AND > C.personId = D.personId ) ) ; > > [.............] > > We can see that the query plan is very different between versions > and that 9.2 is really wrong with the number of rows involved. Why > is 9.2 taking so wrong about the number of rows involved in some > parts of the plan? > Hei More information: If we turn off enable_indexscan the runtime gets more similar to the one we get with 9.1, we are down to 4200ms. The query plan with this configuration is here: http://explain.depesz.com/s/jVR The question remains the same, why is 9.2 using such a different and bad plan compared to 9.1, when the data and the configuration are the same? regards, - -- Rafael Martinez Guerrero Center for Information Technology University of Oslo, Norway PGP Public Key: http://folk.uio.no/rafael/ -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.14 (GNU/Linux) iEYEARECAAYFAlIcbx8ACgkQBhuKQurGihReJgCcCiEfGQ0rZHcazlN3Ihb2PeCn jOsAnjkh1M0j4r1DQJ4Xb1djZ+y4mji3 =Td8b -----END PGP SIGNATURE----- -- Sent via pgsql-performance mailing list (pgsql-performance@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-performance