Received: from maia.hub.org (maia-3.hub.org [200.46.204.243]) by mail.postgresql.org (Postfix) with ESMTP id 404CF1337B97 for ; Fri, 18 Mar 2011 07:41:13 -0300 (ADT) Received: from mail.postgresql.org ([200.46.204.86]) by maia.hub.org (mx1.hub.org [200.46.204.243]) (amavisd-maia, port 10024) with ESMTP id 65270-03 for ; Fri, 18 Mar 2011 10:41:06 +0000 (UTC) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from mailout.thl.fi (mailout.thl.fi [193.167.195.59]) by mail.postgresql.org (Postfix) with ESMTP id 9DF6E1337B43 for ; Fri, 18 Mar 2011 07:41:05 -0300 (ADT) Received: from mailout (localhost.localdomain [127.0.0.1]) by mailout.thl.fi (8.13.1/8.13.1) with SMTP id p2IAf2d7032343; Fri, 18 Mar 2011 12:41:02 +0200 Received: from 172.24.32.92 (172.24.32.92) by mailout (F-Secure/fsigk_smtp/580/mailout); Fri, 18 Mar 2011 12:41:02 +0200 (EET) X-Virus-Status: clean(F-Secure/fsigk_smtp/580/mailout) Received: from exhub1.stakes.fi (exhub1.stakes.fi [10.10.3.203]) by mail-hub.thl.fi (8.13.8/8.13.8) with ESMTP id p2IAf2Ij027033; Fri, 18 Mar 2011 12:41:02 +0200 Received: from [172.22.12.109] (172.22.12.109) by exhub1.stakes.fi (10.10.3.203) with Microsoft SMTP Server id 8.2.176.0; Fri, 18 Mar 2011 12:41:02 +0200 Message-ID: <4D833AE8.9020608@thl.fi> Date: Fri, 18 Mar 2011 12:58:48 +0200 From: =?UTF-8?B?QW5zc2kgS8Okw6RyacOkaW5lbg==?= User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.2.14) Gecko/20110223 Thunderbird/3.1.8 MIME-Version: 1.0 To: Pavel Stehule CC: "pgsql-performance@postgresql.org" Subject: Re: Disabling nested loops - worst case performance References: <4D8306A7.7020205@thl.fi> In-Reply-To: Content-Type: text/plain; charset="UTF-8"; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=-1.91 tagged_above=-10 required=5 tests=BAYES_00=-1.9, T_RP_MATCHES_RCVD=-0.01 X-Spam-Level: X-Archive-Number: 201103/207 X-Sequence-Number: 42886 On 03/18/2011 09:02 AM, Pavel Stehule wrote: > for example queries with LIMIT clause can be significantly faster with > nested loop. But you don't need to disable nested loop globally. > > You can wrap your query to sql functions and disable nested loop just > for these functions. Thank you for your help, the LIMIT example was something I was not aware of. The problem is we are replacing an old database, and we need to replicate certain views for external users. Minimal impact for these users is required. Maybe it would be best to create special user accounts for these external users and disable nested loops only for those accounts. Otherwise we will disable nested loops when absolutely necessary. - Anssi