Received: from maia.hub.org (maia-2.hub.org [200.46.204.251]) by mail.postgresql.org (Postfix) with ESMTP id 381FC1337B95 for ; Sat, 6 Nov 2010 13:54:10 -0300 (ADT) Received: from mail.postgresql.org ([200.46.204.86]) by maia.hub.org (mx1.hub.org [200.46.204.251]) (amavisd-maia, port 10024) with ESMTP id 04673-06 for ; Sat, 6 Nov 2010 16:54:03 +0000 (UTC) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from karnak.local (cpc2-lutn10-2-0-cust603.9-3.cable.virginmedia.com [81.97.90.92]) by mail.postgresql.org (Postfix) with ESMTP id 01EF51337B93 for ; Sat, 6 Nov 2010 13:54:02 -0300 (ADT) Received: from localhost (localhost [127.0.0.1]) by karnak.local (Postfix) with ESMTP id DF6EB3003 for ; Sat, 6 Nov 2010 16:54:01 +0000 (GMT) X-Virus-Scanned: by amavisd-new using ClamAV at karnak.local Received: from karnak.local ([127.0.0.1]) by localhost (karnak.local [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id hsAe9RH5GBGY for ; Sat, 6 Nov 2010 16:53:59 +0000 (GMT) Received: from karnak.local (localhost [127.0.0.1]) by karnak.local (Postfix) with ESMTP id DEB223002 for ; Sat, 6 Nov 2010 16:53:59 +0000 (GMT) Date: Sat, 6 Nov 2010 16:53:54 +0000 From: David W Noon To: pgsql-admin@postgresql.org Subject: Re: Interesting Query Performance Question Message-ID: <20101106165354.67ed9532@karnak.local> In-Reply-To: <20024.1289059188@sss.pgh.pa.us> References: <68C107706843A54BA7D9CAEF123ADF05010346CAE6@SP2-EX07VS03.ds.corp.yahoo.com> <20024.1289059188@sss.pgh.pa.us> Organization: Luton Operatic Society X-Mailer: Claws Mail 3.7.6 (GTK+ 2.20.1; i686-pc-linux-gnu) Mime-Version: 1.0 Content-Type: multipart/signed; micalg=PGP-SHA1; boundary="Sig_/SDuED6vYG.BiTAEi4aSs_8H"; protocol="application/pgp-signature" X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=2.418 tagged_above=-10 required=5 tests=BAYES_00=-1.9, RCVD_IN_PBL=3.335, RCVD_IN_SORBS_DUL=0.001, RDNS_DYNAMIC=0.982 X-Spam-Level: ** X-Archive-Number: 201011/56 X-Sequence-Number: 36022 --Sig_/SDuED6vYG.BiTAEi4aSs_8H Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: quoted-printable On Sat, 06 Nov 2010 11:59:48 -0400, Tom Lane wrote about Re: [ADMIN] Interesting Query Performance Question: >In general, NOT IN is hard to optimize because of its weird behavior >for NULLs. I'd suggest looking into converting the query to use an >EXISTS instead. I have know about that issue for some years, so I always use a column that has been declared NOT NULL for the sub-query. Does PostgreSQL not use that property to bypass the vagaries of NULL in an IN predicate? --=20 Regards, Dave [RLU #314465] *-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-* dwnoon@ntlworld.com (David W Noon) *-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-* --Sig_/SDuED6vYG.BiTAEi4aSs_8H Content-Type: application/pgp-signature; name=signature.asc Content-Disposition: attachment; filename=signature.asc -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.16 (GNU/Linux) iEYEARECAAYFAkzViCcACgkQc9/LpQ70v492xQCgk5aWOekhL3Qnbs9xmvGslFFQ Tm8AniohsU9QybauDZkuS+x0q7k4H18u =oBPD -----END PGP SIGNATURE----- --Sig_/SDuED6vYG.BiTAEi4aSs_8H--