Received: from sss2.sss.pgh.pa.us (sss.pgh.pa.us [209.114.166.2]) by hub.org (8.9.3/8.9.3) with ESMTP id RAA34264 for ; Mon, 17 Jan 2000 17:27:07 -0500 (EST) (envelope-from tgl@sss.pgh.pa.us) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss2.sss.pgh.pa.us (8.9.3/8.9.3) with ESMTP id RAA22021; Mon, 17 Jan 2000 17:26:57 -0500 (EST) To: Marten Feldtmann cc: pgsql-sql@postgreSQL.org Subject: Re: [SQL] index usage ... strange !? In-reply-to: <200001171929.UAA04218@feki.toppoint.de> References: <200001171929.UAA04218@feki.toppoint.de> Comments: In-reply-to Marten Feldtmann message dated "Mon, 17 Jan 2000 20:29:34 +0100" Date: Mon, 17 Jan 2000 17:26:57 -0500 Message-ID: <22018.948148017@sss.pgh.pa.us> From: Tom Lane Marten Feldtmann writes: > SELECT AO,AT,AV FROM P3AT > WHERE EXISTS( SELECT AO FROM P3AT WHERE AV='12' AND AT=12 AND CI=17) Um ... I dunno what you are trying to accomplish, but this query almost certainly doesn't do what you want. Since the inner query is independent of the outer, you will get back either all the rows of P3AT (if the inner query yields rows) or none (if it doesn't). The plan you quote is perfectly reasonable for this query... the machine is even bright enough to figure out that it only needs to evaluate the subquery once. regards, tom lane