Created
January 5, 2015 02:06
-
-
Save m2ym/abed17a99571e558fba8 to your computer and use it in GitHub Desktop.
Slow recursive query
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
WITH RECURSIVE t AS ( | |
SELECT source, target FROM edge | |
UNION | |
SELECT e.source, t.target FROM edge e INNER JOIN t ON e.target = t.source | |
) | |
SELECT target FROM t WHERE source = 123 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment