What's up guys. I have a couple of tables where i inserting much of data (and almost never deleting). Periodically i see that insert gains ExclusiveLock on index of table. So i guess that sometimes insert triggers reindex of table. So i wonder how often it happens and how can i see in logs how much time it took and how often it is triggered? Maybe some blogs/docs on it ? thanks in advance.
1 Answer
There is no automatic reindexing. What you are probably seeing is an exclusive lock on the right to extend the index (add a new 8 kB block to the end of it), not on the index itself.
What tool are you using to observe these locks? Does it give a 'locktype' field or something similar?
-
i'm using select from pg_locks. Yes, locktype is provided by this query and it displays that index relation is locked in ExclusiveMode. I thought that was reindex... But it lasts not very long. So you maybe right about appending.– ArtemPJul 6, 2016 at 20:59
-
"ExclusiveMode" would be the
mode
, not thelocktype
. Thelocktype
should be either "relation" or "extend". (There are other possibilities than those two, but I don't think the others are relevant here)– jjanesJul 7, 2016 at 17:21