• Marko Mäkelä's avatar
    MDEV-24818: Optimize multi-statement INSERT into an empty table · f51bd5cc
    Marko Mäkelä authored
    If the user "opts in" (as in the parent commit), we can optimize
    multiple INSERT statements to use table-level locking and undo logging.
    There will be a change of behavior:
    
        CREATE TABLE t(a PRIMARY KEY) ENGINE=InnoDB;
        SET foreign_key_checks=0, unique_checks=0;
        BEGIN; INSERT INTO t SET a=1; INSERT INTO t SET a=1; COMMIT;
    
    will end up with an empty table, because in case of an error,
    the entire transaction will be rolled back, instead of rolling
    back the failing statement. Previously, the second INSERT statement
    would have been logged row by row, and only that second statement
    would have been rolled back, leaving the first INSERT intact.
    f51bd5cc
btr0cur.cc 243 KB