From: Bulat Niatshin <niatshin@tarantool.org> To: tarantool-patches@freelists.org Cc: korablev@tarantool.org, Bulat Niatshin <niatshin@tarantool.org> Subject: [tarantool-patches] [PATCH] sql: remove unnecessary MakeRecord opcodes Date: Wed, 4 Apr 2018 15:38:13 +0300 [thread overview] Message-ID: <20180404123813.93961-1-niatshin@tarantool.org> (raw) OP_MakeRecord creates a record from a given range of registers and stores that record in a specified register. But now even secondary indexes with non-default ON CONFLICT clause doesn't need it, it is necessary only for primary key indexes. However that unnecesary opcodes appear in INSERT listings. This patch contains a fix for that. Closes #3317 --- src/box/sql/insert.c | 16 ++++------------ 1 file changed, 4 insertions(+), 12 deletions(-) diff --git a/src/box/sql/insert.c b/src/box/sql/insert.c index 4a57b23f5..701fae412 100644 --- a/src/box/sql/insert.c +++ b/src/box/sql/insert.c @@ -1309,18 +1309,10 @@ sqlite3GenerateConstraintChecks(Parse * pParse, /* The parser context */ sqlite3VdbeResolveLabel(v, skip_if_null); } } - if (IsPrimaryKeyIndex(pIdx) || uniqueByteCodeNeeded) { - sqlite3VdbeAddOp3(v, OP_MakeRecord, regNewData + 1, - pTab->nCol, aRegIdx[ix]); - VdbeComment((v, "for %s", pIdx->zName)); - } - } else { - /* kyukhin: for Tarantool, this should be evaluated to NOP. */ - if (IsPrimaryKeyIndex(pIdx) || uniqueByteCodeNeeded) { - sqlite3VdbeAddOp3(v, OP_MakeRecord, regIdx, - nIdxCol, aRegIdx[ix]); - VdbeComment((v, "for %s", pIdx->zName)); - } + + sqlite3VdbeAddOp3(v, OP_MakeRecord, regNewData + 1, + pTab->nCol, aRegIdx[ix]); + VdbeComment((v, "for %s", pIdx->zName)); } /* In an UPDATE operation, if this index is the PRIMARY KEY -- 2.14.1
next reply other threads:[~2018-04-04 12:38 UTC|newest] Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top 2018-04-04 12:38 Bulat Niatshin [this message] 2018-04-04 12:42 ` [tarantool-patches] " Bulat Niatshin 2018-04-11 19:32 ` [tarantool-patches] " n.pettik 2018-04-13 11:35 ` [tarantool-patches] " Bulat Niatshin 2018-04-22 11:20 ` n.pettik 2018-04-26 6:52 ` Kirill Yukhin
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=20180404123813.93961-1-niatshin@tarantool.org \ --to=niatshin@tarantool.org \ --cc=korablev@tarantool.org \ --cc=tarantool-patches@freelists.org \ --subject='Re: [tarantool-patches] [PATCH] sql: remove unnecessary MakeRecord opcodes' \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: link
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox