[MDEV-26096] Make the Unique index ONLY evaluate immediately before the commit (NOT after each UPDATE) Created: 2021-07-06 Updated: 2023-11-30 |
|
| Status: | Stalled |
| Project: | MariaDB Server |
| Component/s: | Storage Engine - InnoDB |
| Fix Version/s: | None |
| Type: | New Feature | Priority: | Major |
| Reporter: | Nilnandan Joshi | Assignee: | Marko Mäkelä |
| Resolution: | Unresolved | Votes: | 1 |
| Labels: | None | ||
| Issue Links: |
|
||||||||||||||||||||
| Description |
|
Make the Unique index ONLY evaluate immediately before the commit and NOT after each UPDATE ("Deferred Constraints Check" )
upstream feature request: https://bugs.mysql.com/bug.php?id=68360 Also this feature should be implemented as a optional and not by default so if anyone wants to use the old way, they can. |
| Comments |
| Comment by Hartmut Holzgraefe [ 2021-07-07 ] |
|
Looking at other SQL products, e.g. PostgreSQL allows to declare a CONSTRAINT as either IMMEDIATE or DEFERRED, with DEFERRED meaning "check at COMMIT time": https://www.postgresql.org/docs/13/sql-set-constraints.htm IMMEDIATE checks still being the default behavior so there, DEFERRED checks need to be declared explicitly. |
| Comment by Hartmut Holzgraefe [ 2021-07-07 ] |
|
IMMEDIATE/DEFERRED constraint checks seem to be defined in ISO/IEC 9075-2:2008 subclauses 10.8 and 17.4 if I read this correctly: |
| Comment by Julien Fritsch [ 2021-09-23 ] |
|
Duplicated by MDEV-26097 |
| Comment by Marko Mäkelä [ 2022-01-25 ] |
|
I do not think that this exactly duplicates MDEV-26097. It is related to or part of that task, but not duplicating it. |
| Comment by Marko Mäkelä [ 2022-01-25 ] |
|
My idea for fixing I think that deferred unique key checks could be implemented inside InnoDB by simply traversing the undo log at XA PREPARE or COMMIT time. This would require some storage engine API changes, because there currently is no such call. Such API change might also be needed for fixing MDEV-24608. |