Thread: Locks, more complicated than I orginally thought

Locks, more complicated than I orginally thought

From
Chris Humphries
Date:
Hello all,    I am working on that SHOW locks todo item, that lists all current locks. This seems a bit tricky as there
isno central place where one could reference a lock, appears they are just called.    Now my question is that, would it
be"ok" to have a locks linked list that held all the locks, and their information in the function calls that make the
lock?Or is there some other method that would be more suitable for this. Seeking the advice of experience with this
sortathing (if there is anyone, heh).    If there was this one master linked list, holding all the lock information,
thenmaking a SHOW locks like command would be a snap!    Also do you think this sort of action would slow the database
downtoo much to even warrent doing it this way? Of course i personally havent tested yet, so have no figures, but you
guysknow more about database programming and postgresql.
 

Thanks,
Chris



Re: Locks, more complicated than I orginally thought

From
Tom Lane
Date:
Chris Humphries <chumphries@devis.com> writes:
>      Now my question is that, would it be "ok" to have a locks
>   linked list that held all the locks, and their information
>   in the function calls that make the lock?

Huh?  The lock manager keeps lists that show all the locks held by a
given process.  These data structures are even rather better documented
than is usual for Postgres: src/backend/storage/lmgr/README.
        regards, tom lane