Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1WZi2e-0005CC-AG for pgsql-performance@arkaria.postgresql.org; Mon, 14 Apr 2014 14:39:24 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.80) (envelope-from ) id 1WZi2d-00061r-Q0 for pgsql-performance@arkaria.postgresql.org; Mon, 14 Apr 2014 14:39:23 +0000 Received: from makus.postgresql.org ([2001:4800:7903:4::125]) by malur.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1WZi2c-00061k-Ia for pgsql-performance@postgresql.org; Mon, 14 Apr 2014 14:39:22 +0000 Received: from nm5-vm4.bullet.mail.ne1.yahoo.com ([98.138.91.165]) by makus.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1WZi2Z-0000va-2W for pgsql-performance@postgresql.org; Mon, 14 Apr 2014 14:39:22 +0000 Received: from [98.138.100.118] by nm5.bullet.mail.ne1.yahoo.com with NNFMP; 14 Apr 2014 14:39:17 -0000 Received: from [98.138.87.5] by tm109.bullet.mail.ne1.yahoo.com with NNFMP; 14 Apr 2014 14:39:17 -0000 Received: from [127.0.0.1] by omp1005.mail.ne1.yahoo.com with NNFMP; 14 Apr 2014 14:39:17 -0000 X-Yahoo-Newman-Property: ymail-3 X-Yahoo-Newman-Id: 964604.33117.bm@omp1005.mail.ne1.yahoo.com Received: (qmail 53651 invoked by uid 60001); 14 Apr 2014 14:39:17 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ymail.com; s=s1024; t=1397486357; bh=jEy8iZs7ky1TZQe5Ow2gj4E6Wle7FFOoaKea6GT50D0=; h=X-YMail-OSG:Received:X-Rocket-MIMEInfo:X-Mailer:Message-ID:Date:From:Subject:To:Cc:In-Reply-To:MIME-Version:Content-Type; b=I20CaZIw6UQ6fn4RGm5rIClQ7kXkEvkeSpWnXe84PQBULB/xWx8QrNGUN/A/n5OoC4VeOgy+yQqyJ+Q2qO9VC66ef5AsO4OyxlBwCpacJGhn3OicK2otDefe97AKIFzZ2ILTig74usiFGY5Ys0lJBh9TWeeus7/c49jAPcI40w8= DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=s1024; d=ymail.com; h=X-YMail-OSG:Received:X-Rocket-MIMEInfo:X-Mailer:Message-ID:Date:From:Subject:To:Cc:In-Reply-To:MIME-Version:Content-Type; b=GsYeqqC+eOUrZp23AJycmwCPwug+8HIW6DTYrIumA9wr/KckPUYIz7U/fnd1bXhlEJ5fVT0500+5wT4M7HsME8sNAzKR6pIBWbFMOWOC19lPkFxXpOjH942TffnJSXEMnnRRgw0A/FdQno6BOg5wSJvyrcOB/6RU5vzQd5p6Ohs=; X-YMail-OSG: _OrM1MsVM1n_95KBSW71AjLmq42QhFXWDlof_pn9wD2G50l 6n54yr3_0HiQIfOLv4fh__cOKPgbmmQQ9sFRTxydiuMUYDBOV4IvmRGuQVPV mqZuTgjgzq.isPpDqyQtmRkKMfCA_IPImjmSDt7IA7bLWcJBbFiRgmFrXIOv jLVbhRKBeRDe87pN2.9BtbtKVnH4disyIGMoBFy9GIyQP.to.sKKN3ekZmFc dpFAnsHv8UeP4bUV3I4191IwJdzpBWaXecYIJTrV_ndH1XCb8mtOtgRgjzAc j1DSynQjE9CfOMMoaPDLYSDzL4G_9ASSwktOHhFjpftCF1eq9EVhDJfzB5Ui FHuF60mT45vTRNxY13UMGq0XItXS_XeI7mKKp8WaFBb6fnrUsZDeMRs8fauF d_t3vRyGUb66tQDQzYeAUC48lrBpSsD.9.FHcDS6zr9KRHkQVUShcFMPT4BC GbNQhTAL9nVcuG4JdTsldhodzvA7rW3ZLUlzvM9XD5U_pbg3vTd24SRiwdFx PPe3pSQkRAEMobF9dPTHvHyNx9lPQODgaUFq7rhXoyYLYD1jECH1Orvz0zu2 Y9YWVj7VE9VQec2SNprylIkGFoQ4- Received: from [24.178.25.147] by web122305.mail.ne1.yahoo.com via HTTP; Mon, 14 Apr 2014 07:39:17 PDT X-Rocket-MIMEInfo: 002.001, U2hhdW4gVGhvbWFzIDxzdGhvbWFzQG9wdGlvbnNob3VzZS5jb20.IHdyb3RlOg0KDQo.IHRoZXNlIGlzc3VlcyB0ZW5kIHRvIGdldCBzb2x2ZWQgdGhyb3VnaCBvcHRpbWl6YXRpb24gZmVuY2VzLg0KPiBSZW9yZ2FuaXplIGEgcXVlcnkgaW50byBhIENURSwgb3IgdXNlIHRoZSAoZ3Jvc3MpIE9GRlNFVCAwIHRyaWNrLg0KPiBIb3cgYXJlIHRoZXNlIG5vdGhpbmcgb3RoZXIgdGhhbiB1bm9mZmljaWFsIGhpbnRzPw0KDQpZZWFoLCB0aGUgY29nbml0aXZlIGRpc3NvbmFuY2UgbGV2ZWxzIGdldCBwcmV0dHkgaGkBMAEBAQE- X-Mailer: YahooMailClassic/481 YahooMailWebService/0.8.185.657 Message-ID: <1397486357.89780.YahooMailBasic@web122305.mail.ne1.yahoo.com> Date: Mon, 14 Apr 2014 07:39:17 -0700 (PDT) From: Kevin Grittner Subject: Re: Getting query plan alternatives from query planner? To: Craig James , Atri Sharma , Shaun Thomas Cc: Stefan Keller , Tom Lane , "pgsql-performance@postgresql.org" In-Reply-To: <532C966D.2080500@optionshouse.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Pg-Spam-Score: -0.6 (/) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-performance Precedence: bulk Sender: pgsql-performance-owner@postgresql.org Shaun Thomas wrote: > these issues tend to get solved through optimization fences. > Reorganize a query into a CTE, or use the (gross) OFFSET 0 trick. > How are these nothing other than unofficial hints? Yeah, the cognitive dissonance levels get pretty high around this issue. Some of the same people who argue strenuously against adding hints about what plan should be chosen also argue against having clearly equivalent queries optimize to the same plan because they find the fact that they don't useful for coercing a decent plan sometimes. That amounts to a hint, but obscure and undocumented. (The OP may be wondering what this "OFFSET 0 trick" is, and how he can use it.) > Well... they're worse, really. Hints can be deprecated, disabled > in configs, or ignored in extreme cases. Optimization fences are > truly forever. +1 With explicit, documented hints, one could search for hints of a particular type should the optimizer improve to the point where they are no longer needed. It is harder to do that with subtle differences in syntax choice. Figuring out which CTEs or LIMITs were chosen because they caused optimization barriers rather than for their semantic merit takes some effort. -- Kevin Grittner EDB: http://www.enterprisedb.com The Enterprise PostgreSQL Company -- Sent via pgsql-performance mailing list (pgsql-performance@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-performance