Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1d2ixt-0004Iy-No for pgsql-hackers@arkaria.postgresql.org; Mon, 24 Apr 2017 18:44:01 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84_2) (envelope-from ) id 1d2ixt-0004NH-5J for pgsql-hackers@arkaria.postgresql.org; Mon, 24 Apr 2017 18:44:01 +0000 Received: from makus.postgresql.org ([2001:4800:1501:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1d2ixq-00049r-Mi for pgsql-hackers@postgresql.org; Mon, 24 Apr 2017 18:43:58 +0000 Received: from out4-smtp.messagingengine.com ([66.111.4.28]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1d2ixo-000441-9Q for pgsql-hackers@postgresql.org; Mon, 24 Apr 2017 18:43:57 +0000 Received: from compute5.internal (compute5.nyi.internal [10.202.2.45]) by mailout.nyi.internal (Postfix) with ESMTP id CC35321AB5; Mon, 24 Apr 2017 14:43:54 -0400 (EDT) Received: from frontend1 ([10.202.2.160]) by compute5.internal (MEProxy); Mon, 24 Apr 2017 14:43:54 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to:x-me-sender :x-me-sender:x-sasl-enc:x-sasl-enc; s=fm1; bh=mqpIaIwf8pSyrNCnmI zR9a+2qQkuMqE4gNcEXc4aqww=; b=QYO5PVff/yVbJxFMpgzDMRA8dVDHyM7QLt mIzhYCgaYZ+xNXFcoFBvSbfkdkEFhWhwjeNsyi9661TZ7XQHSU+jvXUbmz1UHXzT yPo1z6qDJ3zmEAAfN5EMHeQJtrz1YNWXIyuI26QLd6FTuYwD26q2WLBeowHGFy0q cKZiQ0bsR1e2kYYnbUWbfpfP0ksr8Y+15b6+jZnuWpr2QQjCpirVqxtFYSdayKP9 iERGtnue16rX1e3Myb/wJ4jvK7OIkszqXoD0GOg5Rin0D5kOHarATfnfSjdKV8f6 VLuZM4Yz0IOjgrjbbd7LYthwTykpB/r9fxmxb3YKfqk5TTKSDjuA== X-ME-Sender: X-Sasl-enc: Sf8ioZWxKS5i91tAes6H6wjEaTF4w2yfqh6VhjXnnRly 1493059434 Received: from intern.anarazel.de (unknown [208.72.138.107]) by mail.messagingengine.com (Postfix) with ESMTPA id 90FA47E712; Mon, 24 Apr 2017 14:43:54 -0400 (EDT) Date: Mon, 24 Apr 2017 11:43:53 -0700 From: Andres Freund To: Konstantin Knizhnik Cc: pgsql-hackers@postgresql.org Subject: Re: Cached plans and statement generalization Message-ID: <20170424184353.u2krt2eiw2l6e2af@alap3.anarazel.de> References: <8e76d8fc-8b8c-14bd-d4d1-e9cf193a74f5@postgrespro.ru> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <8e76d8fc-8b8c-14bd-d4d1-e9cf193a74f5@postgrespro.ru> X-Pg-Spam-Score: -2.6 (--) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-hackers Precedence: bulk Sender: pgsql-hackers-owner@postgresql.org Hi, On 2017-04-24 11:46:02 +0300, Konstantin Knizhnik wrote: > So what I am thinking now is implicit query caching. If the same query with > different literal values is repeated many times, then we can try to > generalize this query and replace it with prepared query with > parameters. That's not actuall all that easy: - You pretty much do parse analysis to be able to do an accurate match. How much overhead is parse analysis vs. planning in your cases? - The invalidation infrastructure for this, if not tied to to fully parse-analyzed statements, is going to be hell. - Migrating to parameters can actually cause significant slowdowns, not nice if that happens implicitly. Greetings, Andres Freund -- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers