X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [64.117.224.193]) by svr1.postgresql.org (Postfix) with ESMTP id 64AE5310297 for ; Fri, 27 Jun 2003 15:43:04 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (svr1.postgresql.org [64.117.224.193]) (amavisd-new, port 10024) with ESMTP id 92974-07 for ; Fri, 27 Jun 2003 12:42:54 -0300 (ADT) Received: from davinci.ethosmedia.com (unknown [209.10.40.251]) by svr1.postgresql.org (Postfix) with ESMTP id AA66931022A for ; Fri, 27 Jun 2003 12:42:53 -0300 (ADT) Received: from [63.195.55.98] (HELO spooky) by davinci.ethosmedia.com (CommuniGate Pro SMTP 4.0.2) with ESMTP id 3159539; Fri, 27 Jun 2003 08:43:00 -0700 Content-Type: text/plain; charset="iso-8859-1" From: Josh Berkus Organization: Aglio Database Solutions To: "Bruno BAGUETTE" , Subject: Re: Large querie with several EXISTS which will be often runned Date: Fri, 27 Jun 2003 08:41:40 -0700 User-Agent: KMail/1.4.3 References: In-Reply-To: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Message-Id: <200306270841.40634.josh@agliodbs.com> X-Archive-Number: 200306/189 X-Sequence-Number: 2273 Bruno, > I will have to manage more or less 10.000 products with more or less 2-3 > options by products and more or less 40 options-groups. > > Do you think that this query will be hard for PostgreSQL (currently > 7.2.1 but I will migrate to 7.3.2 when going in production environment) > ? > How can I improve that query to be faster ? Collapse the inner EXISTS into a straight join in the outer EXISTS. Since you are merely checking for existence, there is no reason for the subquery nesting. -- Josh Berkus Aglio Database Solutions San Francisco