Tom Lane wrote:

Also, it'd be interesting to count time spent holding shared lock
separately from time spent holding exclusive.

Tom,

Here is the break down between exclusive & shared LWLocks. Do the numbers look reasonable to you?

Regards,
-Robert

bash-3.00# time ./Tom_lwlock_acquire.d `pgrep -n postgres`
********** LWLock Count: Exclusive **********
            Lock Id            Mode           Count
    ControlFileLock       Exclusive               1
      FreeSpaceLock       Exclusive               9
         XidGenLock       Exclusive             202
    CLogControlLock       Exclusive             203
       WALWriteLock       Exclusive             203
   BgWriterCommLock       Exclusive             222
    BufFreelistLock       Exclusive             305
     BufMappingLock       Exclusive             305
      ProcArrayLock       Exclusive             405
   FirstLockMgrLock       Exclusive             670
      WALInsertLock       Exclusive            1616

********** LWLock Count: Shared **********
            Lock Id            Mode           Count
CheckpointStartLock          Shared             202
    CLogControlLock          Shared             450
SubtransControlLock          Shared             776
         XidGenLock          Shared            2020
      ProcArrayLock          Shared            3778
         SInvalLock          Shared            4040
     BufMappingLock          Shared           40838

********** LWLock Time: Exclusive **********
            Lock Id   Combined Time (ns)
    ControlFileLock                 8301
      FreeSpaceLock                80590
    CLogControlLock              1603557
   BgWriterCommLock              1607122
    BufFreelistLock              1997406
         XidGenLock              2312442
     BufMappingLock              3161683
   FirstLockMgrLock              5392575
      ProcArrayLock              6034396
      WALInsertLock             12277693
       WALWriteLock            324869744

********** LWLock Time: Shared **********
            Lock Id   Combined Time (ns)
    CLogControlLock              3183788
SubtransControlLock              6956229
         XidGenLock             12012576
         SInvalLock             35567976
      ProcArrayLock             45400779
     BufMappingLock            300669441
CheckpointStartLock           4056134243


real    0m24.718s
user    0m0.382s
sys     0m0.181s



---------------------------(end of broadcast)---------------------------
TIP 9: In versions below 8.0, the planner will ignore your desire to
      choose an index scan if your joining column's datatypes do not
      match

Reply via email to