Check if it's worth using a single MERGE
operation for some modes of update_database_table
#7036
Labels
-libs
Libraries: New libraries to be implemented
l-db-write
Libraries: database writer
p-lowest
Should be completed at some point
s-research-needed
Status: the task will require heavy research to complete
Some DB engines provide a
MERGE
operation (Transact-SQL, Postgres) that can be used to do INSERT / UPDATE / DELETE operations in a single pass. This may be more efficient than the current implementation which does every of these 3 steps separately (soUpdate_Or_Insert
relies on 2 update queries andAlign_Tables
relies on 3 (not counting the read-only queries used for checking initial invariants)).However, not all DBs support this, so we will need logic that can still rely on the current implementation. But we can at least try to use
MERGE
on backends where it is available.As part of this task, it could be worth to first measure (in Enso or elsewhere, even local DB or DB-fiddle) how much of a difference does
MERGE
do and if its even worth implementing such an optimization. I suspect it may prove to be a bit faster, but probably not by orders of magnitude, since the major efficiency concern for these updates is whether there is an index available for the key in question. We should compare the 2 scenarios and analyze the difference. Then we can implement the optimization for supporting backends.The text was updated successfully, but these errors were encountered: