@merlin, @kevin: Thank you both -- I'll try your suggestions as soon
as I get back to the mothership.
@kevin: I hear you. (I'm deeply steeped in Ruby on Rails and
foolishly assume that it's easy to read.) With that in mind:
\d user_associations
Table "public.u
On Sun, Mar 18, 2012 at 08:30, Scott Marlowe wrote:
> Why are you joining twice to the parent table? If you're trying to
> recurse without a with clause, then wouldn't you join the last table
> to the one before it?
I'm FAR from being an SQL expert; there's a significant chance that
I'm not thin
On Sat, Mar 17, 2012 at 23:07, Scott Marlowe wrote:
> Yeah try setting [work_mem] to something absurd like 500MB and see if the
> plan changes.
>
Suweet! Sorting now runs in-memory, and that makes a big difference, even
when groveling over 1M records (under 12 seconds rather than 7 hours).
Resu
Disclaimer: this is a re-post, since I wasn't subscribed the first
time I posted. Pardon if this is a duplicate.]
The following query is abysmally slow (e.g. 7 hours+). The goal is to
find "among the users that follow user #1, who do they also follow?"
and to count the latter.
SELECT L2.foll