PostgreSQL Data Migration Tips
engineering.tilt.com
PostgreSQL Data Migration Tips
1–10 of 22 posts
Re: PostgreSQL Data Migration Tips
#2I like how SQL is becoming cool again.
Re: PostgreSQL Data Migration Tips
#3nice ! thank you for this
Re: PostgreSQL Data Migration Tips
#4It was bugging me that the target of the "rosser" link was not pointing to the comment he shared his bulk update technique so I dug it up for anyone else interested:
Re: PostgreSQL Data Migration Tips
#5I like how SQL is becoming cool again.
Did it ever really go out of style?
Re: PostgreSQL Data Migration Tips
#6 FOR UPDATE NOWAIT immediately locks the rows being retrieved in the first step (as if they were to be updated)
Technically "FOR UPDATE" only makes an attempt to lock rows, and the "NOWAIT" instructs postgres, in the case that another transaction already has a lock on the row, to raise an error immediately instead of the default behavior of waiting for the lock to become available.Re: PostgreSQL Data Migration Tips
#7It was bugging me that the target of the "rosser" link was not pointing to the comment he shared his bulk update technique so I dug it up for anyone else interested: https://news.ycombinator.com/item?id=9018756
Author here. Great point, I just updated this link to point directly to his comment rather than his HN profile.
Re: PostgreSQL Data Migration Tips
#8Re: PostgreSQL Data Migration Tips
#9FOR UPDATE NOWAIT immediately locks the rows being retrieved in the first step (as if they were to be updated) Technically "FOR UPDATE" only makes an attempt to lock rows, and the "NOWAIT" instructs postgres, in the case that another transaction already has a lock on the row, to raise an error immediately instead of the default behavior of waiting for the lock to become available. http://www.postgresql.org/docs/9.4/s…
That's a good clarification. I think it's better for the data migration to error out when acquiring the lock on rows and then retry, rather than waiting indefinitely, but YMMV (your mileage may vary).
Re: PostgreSQL Data Migration Tips
#10nice ! thank you for this
No problem mizerable! Glad you enjoyed it.