Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Or if you can't afford to lock the table in the process, before you run UPDATE {foo} WHERE {bar} you back up the relevant rows into a temporary table with SELECT * INTO foo_backup WHERE {bar}.


Postgres uses MVCC (Multiversion concurrency control), it solves concurrency without locking everything you touch.


None of this should cause a table lock: at best you will just lock the affected rows and at worst you will end up with a predicate lock on the where clause.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: