0

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.

0

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. – ArtemP Jul 6 '16 at 20:59
  • "ExclusiveMode" would be the mode, not the locktype. The locktype should be either "relation" or "extend". (There are other possibilities than those two, but I don't think the others are relevant here) – jjanes Jul 7 '16 at 17:21

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.