Timeline for answer to How does postgresql lock tables when inserting and selecting? by Nick Barnes
Current License: CC BY-SA 3.0
Post Revisions
5 events
| when toggle format | what | by | license | comment | |
|---|---|---|---|---|---|
| Mar 7, 2018 at 4:35 | vote | accept | ssb | ||
| Mar 7, 2018 at 4:33 | comment | added | Nick Barnes |
@ssb: No, they won't. Because the effects of an INSERT are hidden from other sessions by the MVCC visibility rules, it doesn't need to lock anyone out, and consequently, will never be stuck waiting to acquire a lock. There is presumably a very brief critical section while it reserves a physical storage location for a new row, but nothing which is held for the duration of the statement. (The one exception to this is if two inserts try to put the same value in a UNIQUE column; in this case, the second statement will block until the first either commits or rolls back.)
|
|
| Mar 7, 2018 at 4:06 | history | edited | Nick Barnes | CC BY-SA 3.0 |
deleted 4 characters in body
|
| Mar 7, 2018 at 2:02 | comment | added | ssb | Thank you! Quick confirmation, though. Reading and writing won't block each other, but for example, say this query takes 5 seconds to run. During that period will other inserts into table 2 be delayed? | |
| Mar 6, 2018 at 12:08 | history | answered | Nick Barnes | CC BY-SA 3.0 |