[tarantool-patches] [PATCH 0/4] Move original SQLite's statistics to server

Nikita Pettik korablev at tarantool.org
Mon Apr 23 23:29:37 MSK 2018

Branch: https://github.com/tarantool/tarantool/tree/np/gh-3253-move-statistics-to-server
Issue: https://github.com/tarantool/tarantool/issues/3253

This patch-set is about transfering statistics containing in
SQL specific struct Table and struct Index to the struct index of
Tarantool. Unused statistics are removed at all.

First patch of the series provides slight optimization of simple
'SELECT COUNT(*)' query compilation. There is no need to hesistate which
index to choose: always use PK. It also allows to remove one usage of
statistics from index.

Second patch removes obsolete SQLite calculation of average tuple size:
it is always possible to get size of space, count of tuples and divide

Third patch adds simple wrapper to fetch tuple count of given
table from server.

The last and the main one, introduces new member of index's opts to
describe statistics concerning distribution of tuples. Within this patch,
routine used to load statistics from _sql_stat1 and _sql_stat4 has been
reworked to operate directly on Tarantool's structs. It also includes
codestyle fixes.

Nikita Pettik (4):
  sql: optimize compilation of SELECT COUNT(*)
  sql: add average tuple size calculation
  sql: refactor usages of table's tuple count
  sql: move SQL statistics to server

 src/box/index_def.c            |  92 +++++
 src/box/index_def.h            |  90 +++++
 src/box/sql/analyze.c          | 787 ++++++++++++++++++++---------------------
 src/box/sql/build.c            | 107 ------
 src/box/sql/parse.y            |   2 -
 src/box/sql/pragma.c           |  25 +-
 src/box/sql/prepare.c          |   7 +-
 src/box/sql/select.c           | 210 +++++------
 src/box/sql/sqliteInt.h        | 123 +++++--
 src/box/sql/vdbe.c             |   7 +-
 src/box/sql/where.c            | 231 ++++++++----
 src/box/sql/whereexpr.c        |   4 +-
 test/sql-tap/analyze9.test.lua |  81 +++--
 test/sql-tap/eqp.test.lua      |   2 +-
 14 files changed, 954 insertions(+), 814 deletions(-)


More information about the Tarantool-patches mailing list