Skip to content

Blind Replace

Yoshinori Matsunobu edited this page Aug 31, 2020 · 1 revision

MySQL has a REPLACE syntax, which blindly inserts/overwrites a new row. Internally REPLACE reads from a primary key to discover a matching row by the key. If the row exists, it is deleted and a new row overwrites it with the new value. Otherwise it behaves like INSERT. MyRocks optimized REPLACE to issue the RocksDB Put and skip unique key checks. The LSM-tree database made it possible to skip the random read and improved the write throughput.

Blind Replace is disabled by default. It can be enabled as follows (or in my.cnf).

SET GLOBAL enable_blind_replace=1;
Clone this wiki locally