X-Original-To: pgsql-docs-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.2]) by svr1.postgresql.org (Postfix) with ESMTP id 0E972D1B9B6 for ; Tue, 4 Nov 2003 00:38:58 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (neptune.hub.org [200.46.204.2]) (amavisd-new, port 10024) with ESMTP id 76787-02 for ; Mon, 3 Nov 2003 20:38:29 -0400 (AST) Received: from sss.pgh.pa.us (unknown [192.204.191.242]) by svr1.postgresql.org (Postfix) with ESMTP id 030B9D1CA89 for ; Mon, 3 Nov 2003 20:38:26 -0400 (AST) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.12.10/8.12.10) with ESMTP id hA40cM19017696; Mon, 3 Nov 2003 19:38:22 -0500 (EST) To: "Henry B. Hotz" Cc: Stefan Weiss , pgsql-docs@postgresql.org Subject: Re: INNER JOINS in sql-select.html In-reply-to: References: <1503129.DJSjvup6Wb@weyoun.foo.at> <3687.1067554564@sss.pgh.pa.us> Comments: In-reply-to "Henry B. Hotz" message dated "Mon, 03 Nov 2003 15:08:05 -0800" Date: Mon, 03 Nov 2003 19:38:21 -0500 Message-ID: <17695.1067906301@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200311/7 X-Sequence-Number: 2084 "Henry B. Hotz" writes: > You can imply the issue without obfuscating things. How about: > A CROSS JOIN or INNER JOIN is a simple Cartesian product, the same > as you get from listing the two items at the top level of FROM. > CROSS JOIN yields the same results as INNER JOIN ON (TRUE), that is, > no rows are removed by qualification. Okay, but that doesn't do the trick --- it implies that CROSS JOIN isn't equivalent to INNER JOIN ON (TRUE), when in fact they are equivalent, both as to result and performance characteristics. The issue at hand is that an explicit "a JOIN b" may not be equivalent to "FROM a, b". I reworded the passage as CROSS JOIN and INNER JOIN produce a simple Cartesian product, the same result as you get from listing the two items at the top level of FROM, but restricted by the join condition (if any). CROSS JOIN is equivalent to INNER JOIN ON (TRUE), that is, no rows are removed by qualification. does that help? regards, tom lane