Received: from localhost (maia-5.hub.org [200.46.204.182]) by postgresql.org (Postfix) with ESMTP id C4A4E9FA0CC for ; Tue, 19 Dec 2006 12:32:04 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.182]) (amavisd-new, port 10024) with ESMTP id 35254-07 for ; Tue, 19 Dec 2006 12:31:42 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey-1.7.4 Received: from mail.metronet.co.uk (mail.metronet.co.uk [213.162.97.75]) by postgresql.org (Postfix) with ESMTP id 98BB39F9386 for ; Tue, 19 Dec 2006 12:31:42 -0400 (AST) Received: from mainbox.archonet.com (84-51-143-99.archon037.adsl.metronet.co.uk [84.51.143.99]) by smtp.metronet.co.uk (MetroNet Mail) with ESMTP id CC866755EA; Tue, 19 Dec 2006 16:31:41 +0000 (GMT) Received: from [192.168.1.17] (client17.office.archonet.com [192.168.1.17]) by mainbox.archonet.com (Postfix) with ESMTP id 5F1C1FF04; Tue, 19 Dec 2006 16:31:41 +0000 (GMT) Message-ID: <458813ED.50108@archonet.com> Date: Tue, 19 Dec 2006 16:31:41 +0000 From: Richard Huxton User-Agent: Thunderbird 1.5.0.8 (X11/20061115) MIME-Version: 1.0 To: Jeremy Haile Cc: pgsql-performance@postgresql.org Subject: Re: Inner join vs where-clause subquery References: <1166538737.31684.281175363@webmail.messagingengine.com> In-Reply-To: <1166538737.31684.281175363@webmail.messagingengine.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200612/475 X-Sequence-Number: 22531 Jeremy Haile wrote: > I have the following query which performs extremely slow: > select min(nlogid) as start_nlogid, > max(nlogid) as end_nlogid, > min(dtCreateDate) as start_transaction_timestamp, > max(dtCreateDate) as end_transaction_timestamp > from activity_log_facts > where nlogid > ( select max(a.end_nlogid) from > activity_log_import_history a) > and dtCreateDate < '2006-12-18 9:10' Can you post the EXPLAIN ANALYSE for this one please? That'll show us exactly what it's doing. -- Richard Huxton Archonet Ltd