for a page where thousands of nodes are checked for permissions, the query is currently:

(gid = $gid AND realm = '$realm') OR (gid = $gid AND realm = '$realm') OR (gid = $gid AND realm = '$realm') ..... etc

but is much more efficient to be
(gid IN ($gid, $gid, $gid) AND realm = '$realm')

Comments

mdupont’s picture

Issue summary: View changes
Status: Active » Closed (works as designed)

The query is heavy when checking a large number of nodes and with a large number of node_access realms, however your suggestion wouldn't work. gids are per-realm, and a user can have multiple grants (multiple gids) in multiple realms, so we need to check the (gid, realm) tuple, we can't check gid and realm separately.