Monthly Archives: August 2023

Forcing an ARRAY() in postgres subqueries

Quick note to self, when making a complicated query, comparing to data in a subquery, the postgres query planner will sometimes decide to perform the entire outer query without the comparison, cache the results, and then run the inner query. Example: SELECT DISTINCT …FROM …INNER JOIN … ON …WHERE … AND … AND …id IN […]