"George Pavlov" <gpavlov(at)mynewplace(dot)com> writes:
> there is, admittedly, substantial complexity inside v_foo, with GROUP
> BYs on user_id and various subqueries, but my basic thought is that
> should not really matter...
You're unlikely to get any useful comment on this when you have not
shown any of those details, nor even an EXPLAIN.
regards, tom lane