From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-lj1-f195.google.com (mail-lj1-f195.google.com [209.85.208.195]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by dev.tarantool.org (Postfix) with ESMTPS id 88A3246971A for ; Wed, 4 Dec 2019 15:13:48 +0300 (MSK) Received: by mail-lj1-f195.google.com with SMTP id m6so7854127ljc.1 for ; Wed, 04 Dec 2019 04:13:48 -0800 (PST) Date: Wed, 4 Dec 2019 15:13:46 +0300 From: Konstantin Osipov Message-ID: <20191204121346.GQ6592@atlas> References: <534c76888e033e2f37a93ee0f20a1b5ef806498d.1574277369.git.korablev@tarantool.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <534c76888e033e2f37a93ee0f20a1b5ef806498d.1574277369.git.korablev@tarantool.org> Subject: Re: [Tarantool-patches] [PATCH v2 15/16] box: introduce prepared statements List-Id: Tarantool development patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Nikita Pettik Cc: tarantool-patches@dev.tarantool.org, v.shpilevoy@tarantool.org * Nikita Pettik [19/11/21 10:00]: > This patch introduces local prepared statements. Support of prepared > statements in IProto protocol and netbox is added in the next patch. > > Prepared statement is an opaque instance of SQL Virtual Machine. It can > be executed several times without necessity of query recompilation. To > achieve this one can use box.prepare(...) function. It takes string of > SQL query to be prepared; returns extended set of meta-information > including statement's string, parameter's types and names, types and > names of columns of the resulting set, count of parameters to be bound. > Lua object representing result of :prepare() invocation also features method > :execute(). It corresponds to box.execute(stmt.sql_str), i.e. automatically > substitutes string of prepared statement to be executed. Statements are > held in prepared statement cache - for details see previous commit. > After schema changes all prepared statement located in cache are > considered to be expired - they are re-prepared automatically on demand. > It is worth noting that box.execute() always attempts at finding > statement to be executed in prepared statement cache. Thus, once statement > is prepared, both box.execute() and :execute() methods will execute > already compiled statement. > > SQL cache memory limit is regulated by box{sql_cache_size} which can be > set dynamically. Setting it to 0 completely erases cache. > > Part of #2592 Turned out to be not complex at all, eh? Generally, LGTM (will give it another look). The biggest issue so far I see with the entire series is effects of schema version changes and cache size changes on performance/correctness. I'll need to give it some more thought. -- Konstantin Osipov, Moscow, Russia