Re: Cross-Product JOIN?

From: Erik Wienhold <ewie(at)ewie(dot)name>
To: Laurenz Albe <laurenz(dot)albe(at)cybertec(dot)at>, pgsql-docs(at)lists(dot)postgresql(dot)org
Subject: Re: Cross-Product JOIN?
Date: 2023-05-25 06:59:55
Message-ID: 1217818053.151381.1684997995236@office.mailbox.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-docs

> On 25/05/2023 06:52 CEST Laurenz Albe <laurenz(dot)albe(at)cybertec(dot)at> wrote:
>
> On Wed, 2023-05-24 at 21:10 +0200, Erik Wienhold wrote:
> > > On 24/05/2023 15:46 CEST Erik Wienhold <ewie(at)ewie(dot)name> 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: <replaceable>T2</replaceable> (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

In response to

Responses

Browse pgsql-docs by date

  From Date Subject
Next Message Laurenz Albe 2023-05-25 21:46:13 Re: Cross-Product JOIN?
Previous Message Laurenz Albe 2023-05-25 04:52:14 Re: Cross-Product JOIN?