Re: [GENERAL] Joining on CTE is unusually slow?

2014-08-04 Thread David G Johnston
On Mon, Aug 4, 2014 at 3:48 PM, Jon Rosebaugh [via PostgreSQL] < ml-node+s1045698n5813736...@n5.nabble.com> wrote: > On Mon, Aug 4, 2014, at 06:40 PM, Jon Rosebaugh wrote: > > > On Tue, Jul 29, 2014, at 05:38 PM, David G Johnston wrote: > > > You should at least provide some explain a/o explain an

Re: [GENERAL] Joining on CTE is unusually slow?

2014-08-04 Thread Jon Rosebaugh
On Mon, Aug 4, 2014, at 06:40 PM, Jon Rosebaugh wrote: > On Tue, Jul 29, 2014, at 05:38 PM, David G Johnston wrote: > > You should at least provide some explain a/o explain analyse results. > > > > Not to sound pedantic here but you are not JOINing on the CTE, you are > > pushing it into WHERE cla

Re: [GENERAL] Joining on CTE is unusually slow?

2014-08-04 Thread Jon Rosebaugh
On Tue, Jul 29, 2014, at 05:38 PM, David G Johnston wrote: > You should at least provide some explain a/o explain analyse results. > > Not to sound pedantic here but you are not JOINing on the CTE, you are > pushing it into WHERE clause via a pair of sub-selects. Fair criticisms. Okay, here we go

Re: [GENERAL] Joining on CTE is unusually slow?

2014-07-29 Thread David G Johnston
Jon Rosebaugh wrote > This takes over eight minutes to run. Is this the expected behavior when > joining on CTE expressions? > > I realize I haven't given the full schema/metadata/explain output as > explained in the "Slow Query Questions" wiki page You should at least provide some explain a/o ex

[GENERAL] Joining on CTE is unusually slow?

2014-07-29 Thread Jon Rosebaugh
I have a CTE that produces some row ids. I want to do a query with a complicated join based on those row ids. I've tried running them split into two (run CTE query, collect row ids, then run the complicated query with id IN (id_1, id_2, id_3)) and it takes only a few seconds to run, but when I run