#postgres: Idle queries and pg_locks
▻https://hackernoon.com/postgres-idle-queries-and-pg-locks-216b207c3e39?source=rss----3a8144eabf
Getting postgres unstuck when it seems to “hang” or be super slow on queriesSo, I was recently trying to insert 8 million rows into a table in my database (just another day in grad school) and noticed that the query was taking longer than usual. However, if I just selected the 8 million rows, it would execute pretty fast. The table I was inserting into had no triggers or indices, meaning something was blocking the insert.That combination of being able to do fast selects and not being able to do inserts gave me the impression that the table was “locked” by a transaction or something. This had happened to me before, when I had an iPython notebook open and hadn’t closed my connection, and terminated a query midway by crashing the web page.The last time, I knew what was causing the problem, so I (...)