summaryrefslogtreecommitdiff
path: root/doc/src/sgml/queries.sgml
diff options
context:
space:
mode:
Diffstat (limited to 'doc/src/sgml/queries.sgml')
-rw-r--r--doc/src/sgml/queries.sgml13
1 files changed, 12 insertions, 1 deletions
diff --git a/doc/src/sgml/queries.sgml b/doc/src/sgml/queries.sgml
index c53c385365..bd3c3538c3 100644
--- a/doc/src/sgml/queries.sgml
+++ b/doc/src/sgml/queries.sgml
@@ -1681,6 +1681,15 @@ SELECT * FROM search_graph;
</para>
</tip>
+ <tip>
+ <para>
+ The recursive query evaluation algorithm produces its output in
+ breadth-first search order. You can display the results in depth-first
+ search order by making the outer query <literal>ORDER BY</> a
+ <quote>path</> column constructed in this way.
+ </para>
+ </tip>
+
<para>
A helpful trick for testing queries
when you are not certain if they might loop is to place a <literal>LIMIT</>
@@ -1699,7 +1708,9 @@ SELECT n FROM t LIMIT 100;
This works because <productname>PostgreSQL</productname>'s implementation
evaluates only as many rows of a <literal>WITH</> query as are actually
fetched by the parent query. Using this trick in production is not
- recommended, because other systems might work differently.
+ recommended, because other systems might work differently. Also, it
+ usually won't work if you make the outer query sort the recursive query's
+ results or join them to some other table.
</para>
<para>