Joseph Shraibman <jks@selectacast.net> writes:
> Doug McNaught wrote:
> >
> > Joseph Shraibman <jks@selectacast.net> writes:
> >
> > > Compared to 1000 updates that took between 25 and 47 seconds, an update
> > > with 1000 itmes in the IN() took less than three seconds.
> >
> > Did you wrap the 1000 separate updates in a transaction?
> >
> > -Doug
>
> No, at a high level in my application I was calling the method to do the
> update. How would putting it in a transaction help?
If you don't, every update is its own transaction, and Postgres will
sync the disks (and wait for the sync to complete) after every one.
Doing N updates in one transaction will only sync after the whole
transaction is complete. Trust me; it's *way* faster.
-Doug
--
The rain man gave me two cures; he said jump right in,
The first was Texas medicine--the second was just railroad gin,
And like a fool I mixed them, and it strangled up my mind,
Now people just get uglier, and I got no sense of time... --Dylan