By amateescu on
Change record status:
Published (View all published change records)
Project:
Introduced in branch:
8.0.x
Introduced in version:
8.0.0-beta15
Description:
In order to optimize "update-or-insert" database writes, a new Upsert query class has been added.
The Upsert query is lock-free (where possible) and it is optimized for multiple-row inserts. It can only be used on tables that have just one unique / primary key index (e.g. cache tables).
In contrast with the current Merge query, which implements a subset of the ANSI SQL:2003 MERGE command, the Upsert query implements another desirable subset, one that SQLite implements with INSERT ON CONFLICT REPLACE and MySQL implements with REPLACE or INSERT ON DUPLICATE KEY UPDATE.
Other notes:
- The Upsert query does not support the
INSERT ... SELECTsyntax; in MySQL 5.6.4 and later,INSERT ... SELECT ON DUPLICATE KEY UPDATEstatements are flagged as unsafe for statement-based replication. With this change, such statements produce a warning in the log when using statement-based mode - The Upsert query does not support all sorts of
UPDATEexpressions because SQLite only supports theON CONFLICT REPLACEsyntax. The Merge query should be used for complex query expressions.
Impacts:
Site builders, administrators, editors
Module developers