Zack Weinberg writes:
> For each (experiment_id, url_id) pair for some small subset of the
> experiment_ids, I need to query the full_url_id corresponding to the
> *largest* value of redirect_num. The query planner does something
> reasonable with this SELECT:
> => explain (analyze, verbose)
>
Subqueries are evaluated separately when they include an aggregate or
window function as I understand it. I agree that it would be helpful in
your case if that outside qual was pushed inside.
I assume this query is generated by an ORM and you don't just have the
option to simply change it?