Re: recursive query too big to complete. are there any strategies to limit/partition?

From: Jonathan Vanasco <postgres(at)2xlp(dot)com>
To: David G(dot) Johnston <david(dot)g(dot)johnston(at)gmail(dot)com>
Cc: pgsql-general general <pgsql-general(at)postgresql(dot)org>
Subject: Re: recursive query too big to complete. are there any strategies to limit/partition?
Date: 2017-01-27 01:42:42
Message-ID: F8FA8713-F8AB-4AEB-8E14-664D8A2C01C2@2xlp.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general


On Jan 26, 2017, at 7:07 PM, David G. Johnston wrote:

> ​Thinking aloud - why doesn't just finding every record with 5 descendants not work? Any chain longer than 5 would have at least 5 items.

Oh it works. This is why I ask these questions -- new perspectives!

> ​Even without recursion you could build out a five-way self-join and any records that make it that far are guilty. I suppose this assumes your setup is non-cyclic.

There could be cyclic records, but that's easy to filter out. A first approach took 40 seconds to run. A little tweaking is necessary, but this is a great start.

THANK YOU! You saved me!

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Andres Freund 2017-01-27 03:46:26 Re: [GENERAL] C++ port of Postgres
Previous Message David G. Johnston 2017-01-27 00:07:00 Re: recursive query too big to complete. are there any strategies to limit/partition?