Benchmark runtime-array membership as a set operation
Benchmark runtime-array membership as a set operation
When a PostgreSQL authorization filter checks a large runtime array for each candidate row, inspect whether repeated membership scans dominate CPU. A NOT IN subquery over unnest can permit hashed membership where a variable-array ANY expression does not. Preserve SQL three-valued behavior: dropping NULL members or substituting a superficially similar anti-join can change visibility. Compare complete candidate sets under the real reader and test empty and NULL-bearing restrictions before tuning. Planner choices depend on array size, PostgreSQL version and estimates, so this is a measured alternative rather than a universal preference.
Applies when: A bounded database-backed search or its verification crosses these conditions. Keywords: PostgreSQL ANY NOT IN unnest arrays authorization hashing