Skip to content

Instantly share code, notes, and snippets.

@m2ym
Created January 5, 2015 02:06
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save m2ym/abed17a99571e558fba8 to your computer and use it in GitHub Desktop.
Save m2ym/abed17a99571e558fba8 to your computer and use it in GitHub Desktop.
Slow recursive query
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