3 ms·
> Why don't you know whether or not that tuple is in the relation before you start? ... because that requires a redundant query, its associate lookup cost, and
by Ancapistani 6y ago
> Why don't you know whether or not that tuple is in the relation before you start?
... because that requires a redundant query, its associate lookup cost, and in order to be sure that tuple wasn't added or removed between the time your check and the insert/update executes, either a write lock on the table or on the row itself (if it exists).
"Blind" inserts are the right way to go IMO.