Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit a276392

Browse files
committed
Update example of partially constraining join order to use a subselect
in FROM instead of an auxiliary view. We didn't have subselect-in-FROM when I wrote this originally...
1 parent fa0cd64 commit a276392

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

doc/src/sgml/perform.sgml

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<!--
2-
$Header: /cvsroot/pgsql/doc/src/sgml/perform.sgml,v 1.1 2000/12/16 02:29:36 tgl Exp $
2+
$Header: /cvsroot/pgsql/doc/src/sgml/perform.sgml,v 1.2 2001/02/19 00:24:30 tgl Exp $
33
-->
44

55
<chapter id="performance-tips">
@@ -350,10 +350,11 @@ SELECT * FROM a CROSS JOIN b, c, d, e WHERE ...;
350350
might not want to constrain the planner's search for a good ordering
351351
of inner joins inside an outer join. You can't do that directly in the
352352
JOIN syntax, but you can get around the syntactic limitation by using
353-
views. For example,
353+
subselects. For example,
354354
<programlisting>
355-
CREATE VIEW v1 AS SELECT ... FROM a, b, c WHERE ...;
356-
SELECT * FROM d LEFT JOIN v1 ON (...);
355+
SELECT * FROM d LEFT JOIN
356+
(SELECT * FROM a, b, c WHERE ...) AS ss
357+
ON (...);
357358
</programlisting>
358359
Here, joining D must be the last step in the query plan, but the
359360
planner is free to consider various join orders for A,B,C.
@@ -397,7 +398,7 @@ SELECT * FROM d LEFT JOIN v1 ON (...);
397398
command, instead
398399
of a series of INSERT commands. This reduces parsing, planning, etc
399400
overhead a great deal. If you do this then it's not necessary to fool
400-
around with autocommit.
401+
around with autocommit, since it's only one command anyway.
401402
</para>
402403
</sect2>
403404

0 commit comments

Comments
 (0)