Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1d3GwA-000695-G6 for pgsql-hackers@arkaria.postgresql.org; Wed, 26 Apr 2017 07:00:30 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84_2) (envelope-from ) id 1d3Gw9-0000i4-SP for pgsql-hackers@arkaria.postgresql.org; Wed, 26 Apr 2017 07:00:29 +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 1d3Gw7-0000hs-QN for pgsql-hackers@postgresql.org; Wed, 26 Apr 2017 07:00:28 +0000 Received: from mail.postgrespro.ru ([93.174.131.138]) by makus.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1d3Gvs-0003r2-5Z for pgsql-hackers@postgresql.org; Wed, 26 Apr 2017 07:00:26 +0000 Received: from localhost (localhost [127.0.0.1]) by mail.postgrespro.ru (Postfix) with ESMTP id 84FF121C2A89 for ; Wed, 26 Apr 2017 10:00:09 +0300 (MSK) X-Virus-Scanned: Debian amavisd-new at postgrespro.ru Subject: Re: Cached plans and statement generalization DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=postgrespro.ru; s=mail; t=1493190009; bh=G6nmitVbuGx0neZtnQbEaRfB4zfWjBoVtBN9C16/Bv8=; h=To:References:From:Date:In-Reply-To; b=KVjqPm+FqnRBpJYxM92t1Ftumoo7S6//IIGMauYUhyq0kgl1e2g5Vb2CO2XiN/Pwc tLAf0TTbU8D4oQ9aFRI4S9Lf8RqNY+DMHs9gUepW5cOgA7eGXLaEEkI1j19UB65H2T Ek3QlzcJ9wnKjeFPvdWFlYgaWvYCVL8v51IMp/a4= To: pgsql-hackers@postgresql.org References: <8e76d8fc-8b8c-14bd-d4d1-e9cf193a74f5@postgrespro.ru> <20170424184353.u2krt2eiw2l6e2af@alap3.anarazel.de> <1f4c1a22-ecbe-811d-4695-ee4701b8f6c7@postgrespro.ru> <58FFB391.5080101@postgrespro.ru> <58FFB5F0.2020900@postgrespro.ru> <20170425214746.3mngxgbo7yndfgax@alap3.anarazel.de> From: Konstantin Knizhnik Message-ID: Date: Wed, 26 Apr 2017 10:00:17 +0300 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.8.0 MIME-Version: 1.0 In-Reply-To: <20170425214746.3mngxgbo7yndfgax@alap3.anarazel.de> Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit X-Pg-Spam-Score: -2.0 (--) 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 On 26.04.2017 00:47, Andres Freund wrote: > On 2017-04-25 21:11:08 +0000, Doug Doole wrote: >> When I did this in DB2, I didn't use the parser - it was too expensive. I >> just tokenized the statement and used some simple rules to bypass the >> invalid cases. For example, if I saw the tokens "ORDER" and "BY" then I'd >> disallow replacement replacement until I hit the end of the current >> subquery or statement. > How did you manage plan invalidation and such? The same mechanism as for prepared statements. Cached plans are linked in the list by SaveCachedPlan function and are invalidated by PlanCacheRelCallback. > - Andres > > -- Konstantin Knizhnik Postgres Professional: http://www.postgrespro.com The Russian Postgres Company -- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers