[Tarantool-patches] [PATCH v2 14/16] sql: introduce cache for prepared statemets

Kirill Yukhin kyukhin at tarantool.org
Tue Dec 17 17:43:52 MSK 2019


Hello Nikita,
On 21 ноя 00:28, Nikita Pettik wrote:
> This patch introduces cache (as data structure) to handle prepared
> statements and a set of interface functions (insert, delete, find) to
> operate on it. Cache under the hood uses LRU eviction policy. It is
> implemented as a hash table with string keys (which contain original SQL
> statements) and prepared statements (struct sql_stmt which is an alias
> for struct Vdbe) as values. To realise LRU strategy we maintain list of
> nodes: head is the newest prepared statement, tail a candidate to be
> evicted. Size of cache is regulated via box.cfg{sql_cache_size}
> parameter. Cache is global to all sessions. To erase session manually,
> one can set its size to 0. Default cache size is assumed to be 5 Mb.
> 
> Part of #2592

Could you please implement prepared statements storage
machinery according to proposal posted in `discussions`.
Here's the quote:

    Date: Tue, 22 Oct 2019 15:57:09 +0300
    From: Nikita Pettik <korablev at tarantool.org>
    To: dev at tarantool.org
    Cc: kostja.osipov at gmail.com, v.shpilevoy at tarantool.org, georgy at tarantool.org, sergos at tarantool.org
    Subject: Re: [dev] rfc: prepared statements
    User-Agent: Mutt/1.9.2 (2017-12-15)

    On 01 Oct 00:16, Nikita Pettik wrote:
    > Hi everyone,
    >
    > RFC in human-readable format is available here:
    > https://github.com/tarantool/tarantool/blob/np/sql-prepared-stmt-rfc/doc/rfc/2592-prepared-statement.md

    Yesterday we had discussion concerning prepared statements identifiers.
    It was decided to use sequential numeric ids instead of strings since
    strings are likely to add too much overhead on binary protocol payload.
    All problems which may appear due to cluster configuration were decided
    to delegate to proxy. Proxy is assumed to take responsibility of mapping
    query id to appropriate Tarantool instance.


--
Regards, Kirill Yukhin


More information about the Tarantool-patches mailing list