[tarantool-patches] Re: [PATCH v3 2/3] box: run check constraint tests on space alter

Konstantin Osipov kostja at tarantool.org
Tue May 7 23:28:45 MSK 2019


* Kirill Shcherbatov <kshcherbatov at tarantool.org> [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




More information about the Tarantool-patches mailing list