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 D9BA62E31D for ; Tue, 7 May 2019 16:28:48 -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 7UwY7wku9WCe for ; Tue, 7 May 2019 16:28:48 -0400 (EDT) Received: from smtp52.i.mail.ru (smtp52.i.mail.ru [94.100.177.112]) (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 24E422E307 for ; Tue, 7 May 2019 16:28:48 -0400 (EDT) Date: Tue, 7 May 2019 23:28:45 +0300 From: Konstantin Osipov Subject: [tarantool-patches] Re: [PATCH v3 2/3] box: run check constraint tests on space alter Message-ID: <20190507202845.GA5830@atlas> References: <4f44a278-a591-4fbf-b2fa-8cb50200d4b0@tarantool.org> <20190507163948.GC10365@atlas> <1557251257.268416019@f459.i.mail.ru> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <1557251257.268416019@f459.i.mail.ru> 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: Kirill Shcherbatov Cc: tarantool-patches@freelists.org, "n.pettik" * Kirill Shcherbatov [19/05/07 20:49]: > > + if (sql_bind_decode(&bind, i + 1, &new_tuple) != 0 || > > +     sql_bind_column(ck_constraint->stmt, &bind, i + 1) != 0) { > > + diag_set(ClientError, ER_CK_CONSTRAINT_FAILED, > > + ck_constraint->def->name, > > + ck_constraint->def->expr_str); > > + return -1; > >This looks like a pessimization to me. Depending on the >code flow, > >some of the tuple fields may not be accessed at all. Is it >really > >necessary to decode them so agressibvely here? > >Especially since > >you encode *all* space fields. > I'll try to walk though the AST tree and prepare the map of fields that are involved in expression (on check compile operation); > Here there would be binding of **used** fields. > What do you think? It's better to fetch the bound field upon first access. Most paths of the CHECK constraint may not touch most of the fields. -- Konstantin Osipov, Moscow, Russia, +7 903 626 22 32