View Issue Details

IDProjectCategoryView StatusLast Update
0003751SymmetricDSNew Featurepublic2018-10-10 15:23
ReporterelongAssigned Toelong 
Status resolvedResolutionfixed 
Product Version3.10.0 
Target Version3.10.0Fixed in Version3.10.0 
Summary0003751: PostgreSQL 9.5 and newer can use "insert on conflict do nothing" for better performance
DescriptionOn PostgreSQL 9.5 and newer, take advantage of the "insert on conflict do nothing" syntax to get better performance on inserts. It currently uses "insert into table (...) select ... from table where ..." to make sure the row doesn't exist before inserting. This makes it possible to get 0 rows affected, so it knows to fall back to an update statement. But the extra "select" is slower than an ordinary "insert". The reason an ordinary "insert" statement can't be used is because it will get a unique key violation, which rolls back the transaction. The "insert on conflict do nothing" solves the problem by return 0 rows affected without a violation that rolls back the transaction.


There are no notes attached to this issue.

Issue History

Date Modified Username Field Change
2018-10-10 15:18 elong New Issue
2018-10-10 15:18 elong Status new => assigned
2018-10-10 15:18 elong Assigned To => elong
2018-10-10 15:23 elong Status assigned => resolved
2018-10-10 15:23 elong Resolution open => fixed
2018-10-10 15:23 elong Fixed in Version => 3.10.0