Re: SIREAD lock versus ACCESS EXCLUSIVE lock
Tom Lane <tgl@sss.pgh.pa.us>
From: Tom Lane <tgl@sss.pgh.pa.us>
To: "Kevin Grittner" <Kevin.Grittner@wicourts.gov>
Cc: "Heikki Linnakangas" <heikki.linnakangas@enterprisedb.com>, simon@2ndquadrant.com, drkp@csail.mit.edu, pgsql-hackers@postgresql.org
Date: 2011-06-07T18:10:05Z
Lists: pgsql-hackers
"Kevin Grittner" <Kevin.Grittner@wicourts.gov> writes: > I think I've caught up with the rest of the class on why this isn't > sane in DropAllPredicateLocksFromTableImpl, but I wonder about > CheckTableForSerializableConflictIn. We *do* expect to be throwing > errors in here, and we need some way to tell whether an index is > associated with a particular heap relation. Is the catalog cache > the right way to check that here, or is something else more > appropriate? Just to answer the question (independently of Heikki's concern about whether this is needed at all): it depends on the information you have. If all you have is the index OID, then yeah a catcache lookup in pg_index is probably the best thing. If you have an open Relation for the index, you could instead look into its cached copy of its pg_index row. If you have an open Relation for the table, I'd think that looking for a match in RelationGetIndexList() would be the cheapest, since more than likely that information is already cached. regards, tom lane