From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from localhost (localhost [127.0.0.1]) by turing.freelists.org (Avenir Technologies Mail Multiplex) with ESMTP id C5FAD2AB59 for ; Fri, 24 Aug 2018 17:04:08 -0400 (EDT) Received: from turing.freelists.org ([127.0.0.1]) by localhost (turing.freelists.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id G0HRcJ9B824t for ; Fri, 24 Aug 2018 17:04:08 -0400 (EDT) Received: from smtp2.mail.ru (smtp2.mail.ru [94.100.179.91]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by turing.freelists.org (Avenir Technologies Mail Multiplex) with ESMTPS id 82D282AB05 for ; Fri, 24 Aug 2018 17:04:08 -0400 (EDT) Subject: [tarantool-patches] Re: [PATCH 06/10] sql: completely remove support of partial indexes References: <426c951a553688d1a07139596f79512a2caa6c28.1534001739.git.korablev@tarantool.org> <47821985-7073-47BD-9235-207F782EEF1A@tarantool.org> From: Vladislav Shpilevoy Message-ID: <6efdbab9-a26d-2b6d-4d9f-6be13a0300d3@tarantool.org> Date: Sat, 25 Aug 2018 00:04:06 +0300 MIME-Version: 1.0 In-Reply-To: <47821985-7073-47BD-9235-207F782EEF1A@tarantool.org> Content-Type: text/plain; charset="utf-8"; format="flowed" Content-Language: en-US Content-Transfer-Encoding: 8bit Sender: tarantool-patches-bounce@freelists.org Errors-to: tarantool-patches-bounce@freelists.org Reply-To: tarantool-patches@freelists.org List-help: List-unsubscribe: List-software: Ecartis version 1.0.0 List-Id: tarantool-patches List-subscribe: List-owner: List-post: List-archive: To: "n.pettik" , tarantool-patches@freelists.org Thanks for the fixes! See my ones on the branch. On 21/08/2018 19:31, n.pettik wrote: > >> On 13 Aug 2018, at 23:24, Vladislav Shpilevoy wrote: >> >> Thanks for the patch! I have pushed my review fixes in >> a separate commit. >> >> Please, investigate also is it possible to remove pPartial >> variable from constructAutomaticIndex? It would allow to >> remove sql_resolve_part_idx_label alongside. > > ConstructAutomatiIndex() is now dead code, so I can’t really check it. > Lets now remove it. I doubt that this code can be adapted easily, so > it is likely to be re-implemented anyway. > diff --git a/src/box/sql/analyze.c b/src/box/sql/analyze.c index 00d96d220..901951963 100644 --- a/src/box/sql/analyze.c +++ b/src/box/sql/analyze.c @@ -51,9 +51,9 @@ * which the index belongs. In each such row, the stat column will be * a string consisting of a list of integers. The first integer in this * list is the number of rows in the index. (This is the same as the - * number of rows in the table, except for partial indices.) The second - * integer is the average number of rows in the index that have the same - * value in the first column of the index. The third integer is the average + * number of rows in the table.) The second integer is the + * average number of rows in the index that have the same value in + * the first column of the index. The third integer is the average * number of rows in the index that have the same value for the first two * columns. The N-th integer (for N>1) is the average number of rows in * the index which have the same value for the first N-1 columns. For diff --git a/src/box/sql/expr.c b/src/box/sql/expr.c index a41ea8f13..50505b1d3 100644 --- a/src/box/sql/expr.c +++ b/src/box/sql/expr.c @@ -3700,7 +3700,7 @@ sqlite3ExprCodeTarget(Parse * pParse, Expr * pExpr, int target) int iTab = pExpr->iTable; if (iTab < 0) { if (pParse->ckBase > 0) { - /* Generating CHECK constraints or inserting into partial index */ + /* Generating CHECK constraints. */ return pExpr->iColumn + pParse->ckBase; } else { /* Coding an expression that is part of an index where column names diff --git a/src/box/sql/resolve.c b/src/box/sql/resolve.c index 97b642723..9a2d6ff4e 100644 --- a/src/box/sql/resolve.c +++ b/src/box/sql/resolve.c @@ -514,11 +514,13 @@ notValid(Parse * pParse, /* Leave error message here */ { assert((validMask & ~(NC_IsCheck | NC_IdxExpr)) == 0); if ((pNC->ncFlags & validMask) != 0) { - const char *zIn = "partial index WHERE clauses"; + const char *zIn; if (pNC->ncFlags & NC_IdxExpr) zIn = "index expressions"; else if (pNC->ncFlags & NC_IsCheck) zIn = "CHECK constraints"; + else + unreachable(); sqlite3ErrorMsg(pParse, "%s prohibited in %s", zMsg, zIn); } } diff --git a/src/box/sql/select.c b/src/box/sql/select.c index d22f4e0a9..849c0f871 100644 --- a/src/box/sql/select.c +++ b/src/box/sql/select.c @@ -6247,7 +6247,7 @@ sqlite3Select(Parse * pParse, /* The parser context */ * optimized specially. The OP_Count instruction * is executed on the primary key index, * since there is no difference which index - * to choose (except for partial indexes). + * to choose. */ const int cursor = pParse->nTab++; /* diff --git a/src/box/sql/whereInt.h b/src/box/sql/whereInt.h index 548cbcb2a..889a667ae 100644 --- a/src/box/sql/whereInt.h +++ b/src/box/sql/whereInt.h @@ -538,4 +538,3 @@ void sqlite3WhereTabFuncArgs(Parse *, struct SrcList_item *, WhereClause *); #define WHERE_AUTO_INDEX 0x00004000 /* Uses an ephemeral index */ #define WHERE_SKIPSCAN 0x00008000 /* Uses the skip-scan algorithm */ #define WHERE_UNQ_WANTED 0x00010000 /* WHERE_ONEROW would have been helpful */ -#define WHERE_PARTIALIDX 0x00020000 /* The automatic index is partial */ diff --git a/src/box/sql/wherecode.c b/src/box/sql/wherecode.c index 10a3f2d95..b45ca7cbe 100644 --- a/src/box/sql/wherecode.c +++ b/src/box/sql/wherecode.c @@ -231,8 +231,6 @@ sqlite3WhereExplainOneScan(Parse * pParse, /* Parse context */ if (isSearch) { zFmt = "PRIMARY KEY"; } - } else if (flags & WHERE_PARTIALIDX) { - zFmt = "AUTOMATIC PARTIAL COVERING INDEX"; } else if (flags & WHERE_AUTO_INDEX) { zFmt = "AUTOMATIC COVERING INDEX"; } else if (flags & WHERE_IDX_ONLY) {