Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1q24xH-0005GA-34 for pgsql-docs@arkaria.postgresql.org; Thu, 25 May 2023 07:00:11 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1q24xF-0008AS-Ra for pgsql-docs@arkaria.postgresql.org; Thu, 25 May 2023 07:00:09 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1q24xF-0008AI-Jt for pgsql-docs@lists.postgresql.org; Thu, 25 May 2023 07:00:09 +0000 Received: from mout-u-107.mailbox.org ([2001:67c:2050:101:465::107]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1q24xC-0021XP-12 for pgsql-docs@lists.postgresql.org; Thu, 25 May 2023 07:00:09 +0000 Received: from smtp102.mailbox.org (smtp102.mailbox.org [10.196.197.102]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-384) server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by mout-u-107.mailbox.org (Postfix) with ESMTPS id 4QRf7b62K3z9sRw; Thu, 25 May 2023 08:59:55 +0200 (CEST) Date: Thu, 25 May 2023 08:59:55 +0200 (CEST) From: Erik Wienhold To: Laurenz Albe , pgsql-docs@lists.postgresql.org Message-ID: <1217818053.151381.1684997995236@office.mailbox.org> In-Reply-To: <680324ce9104e3d8e9d93b040c152b8bd47b361e.camel@cybertec.at> References: <1667253069.131800.1684935988763@office.mailbox.org> <2053109544.160895.1684955437950@office.mailbox.org> <680324ce9104e3d8e9d93b040c152b8bd47b361e.camel@cybertec.at> Subject: Re: Cross-Product JOIN? MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Priority: 3 Importance: Normal List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk > On 25/05/2023 06:52 CEST Laurenz Albe wrote: > > On Wed, 2023-05-24 at 21:10 +0200, Erik Wienhold wrote: > > > On 24/05/2023 15:46 CEST Erik Wienhold wrote: > > > > > > Personally, I think it should read cartesian product because cross product is > > > an overloaded term and cartesian product is used more often in the documentation > > > overall. > > > > > > But the same page [0] also uses cross product when talking about grouping sets. > > > > > > [0] https://www.postgresql.org/docs/15/queries-table-expressions.html > > > > Here's a patch that fixes those two places. > > +1 > > "Cross product" seems to be a misbegotten hybrid of "cross join" and > "Cartesian product". Cross product can mean Cartesian product depending on the context. [0] > Since we are talking about Cartesian products: is the term "Cartesian join" > used anywhere? Not in the docs: $ git grep -iw cartesian -- doc doc/src/sgml/cube.sgml: the lower-dimensional one is assumed to be a Cartesian projection, i. e., having zeroes doc/src/sgml/perform.sgml: would be inefficient, since the full Cartesian product of A and C doc/src/sgml/planstats.sgml: Cartesian product of the two inputs, multiplied by the doc/src/sgml/queries.sgml: (that is, the Cartesian product of their rows is formed; see below). doc/src/sgml/queries.sgml: T2 (i.e., a Cartesian product), doc/src/sgml/ref/select.sgml: specified, the result is the Cartesian product (cross join) of all doc/src/sgml/ref/select.sgml: Cartesian product. doc/src/sgml/ref/select.sgml: Cartesian product (i.e., all combined rows that pass its join doc/src/sgml/ref/select.sgml: They produce a simple Cartesian product, the same result as you get from but in a few comments: $ git grep -i 'cartesian\(\s\+join\|\s*$\)' src/backend/optimizer/geqo/geqo_eval.c: * a cartesian join to be performed. When force is false, do only src/backend/optimizer/path/joinrels.c: * upper level, we must be willing to make a cartesian join of a and b; src/backend/optimizer/path/joinrels.c: * cartesian joins in this case (no bushy). src/test/regress/expected/join.out:-- test for ability to use a cartesian join when necessary src/test/regress/sql/join.sql:-- test for ability to use a cartesian join when necessary [0] https://mathworld.wolfram.com/CartesianProduct.html -- Erik