X-Original-To: pgsql-general-postgresql.org@postgresql.org Received: from localhost (mx1.hub.org [200.46.208.251]) by postgresql.org (Postfix) with ESMTP id 8EE9E9FA4AE for ; Thu, 3 Aug 2006 05:38:02 -0300 (ADT) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) with ESMTP id 84091-03 for ; Thu, 3 Aug 2006 05:37:52 -0300 (ADT) X-Greylist: domain auto-whitelisted by SQLgrey- Received: from wx-out-0102.google.com (wx-out-0102.google.com [66.249.82.202]) by postgresql.org (Postfix) with ESMTP id 621B09FA48E for ; Thu, 3 Aug 2006 05:37:54 -0300 (ADT) Received: by wx-out-0102.google.com with SMTP id t13so980002wxc for ; Thu, 03 Aug 2006 01:37:51 -0700 (PDT) DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:message-id:date:from:reply-to:to:subject:cc:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; b=kWmkUwHqmjp29KD+rBr0EOlEurjttXailYnyMXomR0BuhxYthjxIg+KHkAWyOB7L9Yax0HsX9JNbaY9MrcOENoCu3L2qcF+V7NdmVrbnHC69yT3L/QPzcSMY3DkXz+UXZY+jbOtu2zLHcVCTAviyWJG9lQ+BI792PJaMfPwOGQQ= Received: by 10.78.107.8 with SMTP id f8mr642635huc; Thu, 03 Aug 2006 01:37:51 -0700 (PDT) Received: by 10.78.176.1 with HTTP; Thu, 3 Aug 2006 01:37:51 -0700 (PDT) Message-ID: Date: Thu, 3 Aug 2006 12:37:51 +0400 From: "Nikolay Samokhvalov" Reply-To: nikolay@samokhvalov.com To: "Christian Rengstl" Subject: Re: Query performance Cc: pgsql-general@postgresql.org In-Reply-To: <44D1CC21.0AD0.0080.0@klinik.uni-regensburg.de> MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Content-Disposition: inline References: <44D1CC21.0AD0.0080.0@klinik.uni-regensburg.de> X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=0.159 tagged_above=0 required=5 tests=AWL, DNS_FROM_RFC_ABUSE, SPF_PASS X-Spam-Level: X-Archive-Number: 200608/145 X-Sequence-Number: 98917 On 8/3/06, Christian Rengstl wrote: > ... > Unfortunately the query takes pretty long for the big table, so maybe one of you has a suggestion on how to make it faster. > try smth like this: select val1, val2, crit from mytable as a where pid='somepid' and exists(select 1 from myCritTable as b where a.crit = b.crit); -- Best regards, Nikolay