X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (mx1.hub.org [200.46.208.251]) by postgresql.org (Postfix) with ESMTP id 1F49D9FA32D for ; Thu, 11 May 2006 02:33:00 -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 08330-05 for ; Thu, 11 May 2006 02:32:51 -0300 (ADT) X-Greylist: from auto-whitelisted by SQLgrey- Received: from svr4.postgresql.org (svr4.postgresql.org [66.98.251.159]) by postgresql.org (Postfix) with ESMTP id 5ABB79FA15C for ; Thu, 11 May 2006 02:32:51 -0300 (ADT) Received: from ls405.htnet.hr (ls405.t-com.hr [195.29.150.135]) by svr4.postgresql.org (Postfix) with ESMTP id 9BFB85B16AA for ; Thu, 11 May 2006 05:32:50 +0000 (GMT) Received: from ls401.t-com.hr (ls401.t-com.hr [195.29.150.236]) by ls405.htnet.hr (Postfix) with ESMTP id 337D6146F52; Thu, 11 May 2006 07:32:47 +0200 (CEST) Received: from ls401.t-com.hr (localhost.localdomain [127.0.0.1]) by ls401.t-com.hr (Qmlai) with ESMTP id 5405AE38E3; Thu, 11 May 2006 07:32:47 +0200 (CEST) X-Envelope-Sender: msplival@jagor.srce.hr X-Envelope-Sender: msplival@jagor.srce.hr Received: from 83-131-51-236.adsl.net.t-com.hr (83-131-51-236.adsl.net.t-com.hr [83.131.51.236]) by ls401.t-com.hr (Qmlai) with ESMTP id 03FA238012; Thu, 11 May 2006 07:32:41 +0200 (CEST) Subject: Re: Lot'sa joins - performance tip-up, please? From: Mario Splivalo To: "Jim C. Nasby" Cc: pgsql-performance@postgresql.org In-Reply-To: <20060510221048.GX99570@pervasive.com> References: <1146533274.14006.11.camel@localhost.localdomain> <17793.1146679117@sss.pgh.pa.us> <1146753957.8538.30.camel@localhost.localdomain> <20060510221048.GX99570@pervasive.com> Content-Type: text/plain Date: Thu, 11 May 2006 07:32:26 +0200 Message-Id: <1147325547.8696.6.camel@localhost.localdomain> Mime-Version: 1.0 X-Mailer: Evolution 2.4.1 Content-Transfer-Encoding: 7bit X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200605/373 X-Sequence-Number: 19160 On Wed, 2006-05-10 at 17:10 -0500, Jim C. Nasby wrote: > On Thu, May 04, 2006 at 04:45:57PM +0200, Mario Splivalo wrote: > Well, here's the problem... > > > -> Nested Loop (cost=0.00..176144.30 rows=57925 width=26) > > (actual time=1074.984..992536.243 rows=57925 loops=1) > > -> Seq Scan on ticketing_codes_played > > (cost=0.00..863.25 rows=57925 width=8) (actual time=74.479..2047.993 > > rows=57925 loops=1) > > -> Index Scan using ticketing_codes_pk on > > ticketing_codes (cost=0.00..3.01 rows=1 width=18) (actual > > time=17.044..17.052 rows=1 loops=57925) > > Index Cond: (ticketing_codes.code_id = > > "outer".code_id) > > Anyone have any idea why on earth it's doing that instead of a hash or > merge join? > > In any case, try swapping the order of ticketing_codes_played and > ticketing_codes. Actually, that'd probably make it worse. I tried that, no luck. The best performance I achieve with creating temporary table. And... > > Try SET enable_nestloop = off; This helps also. I don't get sequential scans any more. I'd like a tip on how to set 'enable_nestloop = off' trough JDBC? Mario -- "I can do it quick, I can do it cheap, I can do it well. Pick any two." Mario Splivalo msplival@jagor.srce.hr