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 6FD5B2810C for ; Mon, 30 Jul 2018 14:34: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 IOtgGjMfKN67 for ; Mon, 30 Jul 2018 14:34:08 -0400 (EDT) Received: from mail-lf1-f66.google.com (mail-lf1-f66.google.com [209.85.167.66]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by turing.freelists.org (Avenir Technologies Mail Multiplex) with ESMTPS id 11B8F280C9 for ; Mon, 30 Jul 2018 14:34:07 -0400 (EDT) Received: by mail-lf1-f66.google.com with SMTP id f18-v6so8853313lfc.2 for ; Mon, 30 Jul 2018 11:34:07 -0700 (PDT) MIME-Version: 1.0 References: <605B15EF-BD1C-4B03-8A9F-6E6225076812@tarantool.org> <12B62C73-9BEC-49FA-B3FD-590C445CF25B@tarantool.org> <2123605D-8D6C-43A3-846F-735E4C2C7FC2@tarantool.org> <20180729011251.eitp7cisv6jv5opj@tkn_work_nb> <20180729151633.mnggrcl4jjnedhxf@tkn_work_nb> In-Reply-To: <20180729151633.mnggrcl4jjnedhxf@tkn_work_nb> From: Nikita Tatunov Date: Mon, 30 Jul 2018 21:33:55 +0300 Message-ID: Subject: [tarantool-patches] Re: [PATCH] sql: xfer optimization issue Content-Type: multipart/alternative; boundary="000000000000dec0a505723bb4cb" 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: Alexander Turenko Cc: korablev@tarantool.org, tarantool-patches@freelists.org --000000000000dec0a505723bb4cb Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable =D0=B2=D1=81, 29 =D0=B8=D1=8E=D0=BB. 2018 =D0=B3. =D0=B2 18:16, Alexander T= urenko < alexander.turenko@tarantool.org>: > On Sun, Jul 29, 2018 at 02:23:30PM +0300, n.pettik wrote: > > > 1. Not actual due to 2, but it would be better to use > > > `pOp->p5 &=3D ~OPFLAG_XFER_OPT` to drop just that flag. > > > 2. It is counter-intuitive, IMHO, to change operation flags during > > > that operation. So, said above, vote to move it to OP_OpenWrite= . > > > > Well, actually moving it to OP_OpenWrite seems to be bad idea. > > > > Even if code for xFer optimisation is generated, it > > > > still might not be executed. The only opcode ensuring xFer is > > > > under processing - OP_RowData. > > We have separate OpenWrite opcodes in xfer and regular insert code. We > open destination space curson always (to determine whether the space is > empty), but we can set the flag when open source space cursor. But this > will forbid to check source space for emptiness in xfer code or will > require to 'workaround' it using two cursors. > > By the way, I observed that the following code is dead: > > > if (emptySrcTest) > > sqlite3VdbeJumpHere(v, emptySrcTest); > > WBR, Alexander Turenko. > I'm not sured if changing p5 in OP_OpenWrite is a good idea since 1) Even if p5 isn't used while xfer is processed it's reserved and there are no free parameters. 2) Who knows, probably we will need p5 for something in future. 3) AFAIK OP_OpenWrite is a legacy opcode and probably gonna be removed. 4) For me it's more counter-intuitive to put incrementation in opcode that barely related to xfer optimization idea. 5) Do CPU cycles matter for debugging purpose only global variable? --000000000000dec0a505723bb4cb Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable


=D0=B2= =D1=81, 29 =D0=B8=D1=8E=D0=BB. 2018 =D0=B3. =D0=B2 18:16, Alexander Turenko= <alexander.turenko@t= arantool.org>:
On Sun, Jul 2= 9, 2018 at 02:23:30PM +0300, n.pettik wrote:
> >=C2=A0 =C2=A0 1. Not actual due to 2, but it would be better to us= e
> >=C2=A0 =C2=A0 =C2=A0 `pOp->p5 &=3D ~OPFLAG_XFER_OPT` to dro= p just that flag.
> >=C2=A0 =C2=A0 2. It is counter-intuitive, IMHO, to change operatio= n flags during
> >=C2=A0 =C2=A0 =C2=A0 =C2=A0that operation. So, said above, vote to= move it to OP_OpenWrite.
>
>=C2=A0 =C2=A0 Well, actually moving it to OP_OpenWrite seems to be bad = idea.
>
>=C2=A0 =C2=A0 Even if code for xFer optimisation is generated, it
>
>=C2=A0 =C2=A0 still might not be executed. The only opcode ensuring xFe= r is
>
>=C2=A0 =C2=A0 under processing - OP_RowData.

We have separate OpenWrite opcodes in xfer and regular insert code. We
open destination space curson always (to determine whether the space is
empty), but we can set the flag when open source space cursor. But this
will forbid to check source space for emptiness in xfer code or will
require to 'workaround' it using two cursors.

By the way, I observed that the following code is dead:

>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0if (emptySrcTest)
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0sqlite3Vd= beJumpHere(v, emptySrcTest);

WBR, Alexander Turenko.

I'm not sur= ed if changing p5 in OP_OpenWrite is a good idea since
1) Even if= p5 isn't used while xfer is processed it's reserved and=C2=A0
there are no free parameters.
2) Who knows, probably we wil= l need p5 for something in future.
3) AFAIK OP_OpenWrite is a leg= acy opcode and probably gonna be
removed.
4) For me it&= #39;s more counter-intuitive to put incrementation in=C2=A0
opcod= e that barely related to xfer optimization idea.
5) Do CPU cycles= matter for debugging purpose only global variable?=C2=A0
--000000000000dec0a505723bb4cb--