On 2021-Mar-26, Joel Jacobson wrote:

> On Fri, Mar 26, 2021, at 11:30, Alvaro Herrera wrote:
> > On 2021-Mar-26, Joel Jacobson wrote:
> > 
> > > On Thu, Mar 25, 2021, at 17:51, Tom Lane wrote:
> > 
> > > > I wonder what performance will be like with lots o' objects.
> > > 
> > > I guess pg_get_acl() would need to be implemented using a switch(classid) 
> > > with 36 cases (one for each class)?
> > 
> > No, we have a generalized object query mechanism, see objectaddress.c
> 
> That's where I was looking actually and noticed the switch with 36 cases, in 
> the function getObjectDescription().

Ah! well, you don't have to repeat that.

AFAICS the way to do it is like AlterObjectOwner_internal obtains data
-- first do get_catalog_object_by_oid (gives you the HeapTuple that
represents the object), then
heap_getattr( ..., get_object_attnum_acl(), ..), and there you have the
ACL which you can "explode" (or maybe just return as-is).

AFAICS if you do this, it's just one cache lookups per object, or
one indexscan for the cases with no by-OID syscache.  It should be much
cheaper than the UNION ALL query.  And you use pg_shdepend to guide
this, so you only do it for the objects that you already know are
interesting.

-- 
Álvaro Herrera       Valdivia, Chile
"La conclusión que podemos sacar de esos estudios es que
no podemos sacar ninguna conclusión de ellos" (Tanenbaum)


Reply via email to