Received: from magus.postgresql.org ([87.238.57.229]) by malur.postgresql.org with esmtp (Exim 4.72) (envelope-from ) id 1TLzuc-0001yJ-KH for pgsql-bugs@postgresql.org; Wed, 10 Oct 2012 17:17:38 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by magus.postgresql.org with esmtp (Exim 4.72) (envelope-from ) id 1TLzuZ-0006tF-1D for pgsql-bugs@postgresql.org; Wed, 10 Oct 2012 17:17:37 +0000 Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.14.5/8.14.5) with ESMTP id q9AHHWif001198; Wed, 10 Oct 2012 13:17:32 -0400 (EDT) From: Tom Lane To: demurcia@ockham-solutions.fr cc: pgsql-bugs@postgresql.org Subject: Re: BUG #7593: Unexpected query result combining or and in operators In-reply-to: References: Comments: In-reply-to demurcia@ockham-solutions.fr message dated "Wed, 10 Oct 2012 15:54:26 -0000" Date: Wed, 10 Oct 2012 13:17:32 -0400 Message-ID: <1197.1349889452@sss.pgh.pa.us> X-Pg-Spam-Score: -4.0 (----) X-Archive-Number: 201210/79 X-Sequence-Number: 34379 demurcia@ockham-solutions.fr writes: > After a little while (probably after the analyze), the query plan is changed > and only 2 results are returned ! > "Merge Join (cost=33.31..39.69 rows=1 width=24)" > " Merge Cond: (i.numero_id = n.numero_id)" > ... > " -> Index Only Scan using numero_pkey on numero n (cost=0.00..12.57 > rows=2 width=8)" > " Index Cond: (numero_id = ANY ('{25393,25384}'::bigint[]))" Yeah, there's a known bug in 9.2 with mergejoins whose inner side is an indexscan with an =ANY condition. There's a fix here, if you're able to apply a patch: http://git.postgresql.org/gitweb/?p=postgresql.git;a=commitdiff;h=f2366e584aea41b980f23fcf0a2e118efd7fb09b Otherwise, the fix will be in 9.2.2. regards, tom lane