The `MERGE` command is implemented as a wrapper around existing SQL commands, calling `CREATE TEMP TABLE`, `UPDATE` and `INSERT` or `DELETE`. The SQL commands issued by `MERGE` seem strange, in that they create and then later read an temporary table, where this work is as far as I can tell wholly unnecessary, and by doing so, `MERGE` is significantly slower than the commands you yourself would issue, where you would not use a temporary table. Additionally, `MERGE` mandates the use of and only of a table for the merge source rows, which is not necessary when issuing an `UPDATE` yourself, as `UPDATE` works also with sub-queries and views.
1 comment
[ 3.1 ms ] story [ 13.3 ms ] thread