It appears that the acl functions use more SELECTs than necessary. For
f_customer_acl(uid
integer, cid integer), I might use:
PERFORM 1 FROM customers JOIN users USING (org_id) WHERE customer_id =
cid and user_id = uid;
RETURN FOUND;
This still requires one call to f_customer_acl() (and therefore one
SELECT) for each row in plan_events (since that's the way the calling
function is written). If the goal is to count the number of plan_events
a specific user has access rights to, I'm sure you can write a query
that would accomplish that directly. It's beyond my knowledge whether
it makes more sense to do this via these function calls.
--Lee
--
Lee Hachadoorian
PhD Student, Geography
Program in Earth & Environmental Sciences
CUNY Graduate Center