RE: MySQL and PostgreSQL speed compare - Mailing list pgsql-general

From Robert D. Nelson
Subject RE: MySQL and PostgreSQL speed compare
Date
Msg-id 3A478C2A@rba6.rbapro.com
Whole thread Raw
In response to MySQL and PostgreSQL speed compare  ("Jarmo Paavilainen" <netletter@comder.com>)
List pgsql-general
>Make a SELECT to check if the row exist.
>If not it make a INSERT, or if its there it make an UPDATE (or something
>totally different).
>
>Everything is swell, but when several pids are trying to insert there is a
>window of error between the SELECT and INSERT. And the test program
>triggered it frequently. What if there were a lot of insert/updated before
>and after the failing one (inside this transaction) and it would be ok if
>this row was inserted by someone else. The dba does not know about that, *I
>do* and can write my program in such a way.
>
>How do you fix that in PostgreSQL! The only way I know of is not to use
>transactions. Then if the INSERT fails you can try again with SELECT to
>check if the row has been inserted by someone else. And ofcourse you would
>need to build your own rollback function.
>
>The "all or nothing approach" ala PostgreSQL is broken!
>
>Nuff about transactions. I do not think I can convince you and you cant
>convince me about that they are not. And why do you not check how the other
>dbas has solved this. I bet they work as I describe.

Wouldn't it be smart to make the select and insert a transaction, and if it
fails, then start an update?


Rob Nelson
rdnelson@co.centre.pa.us


pgsql-general by date:

Previous
From: Stephan Szabo
Date:
Subject: Re: SV: MySQL and PostgreSQL speed compare
Next
From: "Mikheev, Vadim"
Date:
Subject: RE: MySQL and PostgreSQL speed compare