Re: Idea: Avoid JOINs by using path expressions to follow FKs

From: "Joel Jacobson" <joel(at)compiler(dot)org>
To: "Vik Fearing" <vik(at)postgresfriends(dot)org>, "Tom Lane" <tgl(at)sss(dot)pgh(dot)pa(dot)us>, "Andrew Dunstan" <andrew(at)dunslane(dot)net>
Cc: "Alvaro Herrera" <alvherre(at)alvh(dot)no-ip(dot)org>, pgsql-hackers(at)lists(dot)postgresql(dot)org
Subject: Re: Idea: Avoid JOINs by using path expressions to follow FKs
Date: 2021-03-29 15:50:20
Message-ID: 3062a31b-c13a-4fa1-bc35-e9c88953d8b4@www.fastmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Mon, Mar 29, 2021, at 16:17, Vik Fearing wrote:
> If you write your schema like this, then it becomes standards compliant:
> ...
> CREATE TABLE order_details (
> "order" REF(orders),
> product REF(products),
> quantity integer,
> PRIMARY KEY ("order", product)
> );
>
>
> And the query would be:
>
> SELECT DISTINCT order_details."order"->customer->company_name
> FROM order_details
> WHERE order_details.product->product_name = 'Chocolade';
>
>
> Postgres already supports most of that, but not all of it.

Thanks for making me aware of this.
I can see this is "4.9 Reference types" in ISO/IEC 9075-2:2016(E).

This looks awesome.

/Joel

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Tomas Vondra 2021-03-29 15:54:25 Merging statistics from children instead of re-sampling everything
Previous Message Stephen Frost 2021-03-29 15:41:32 Re: Walsender may fail to send wal to the end.