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

From: "Joel Jacobson" <joel(at)compiler(dot)org>
To: pgsql-hackers(at)lists(dot)postgresql(dot)org
Subject: Re: Idea: Avoid JOINs by using path expressions to follow FKs
Date: 2021-04-06 08:11:03
Message-ID: e9b2d98b-a12a-42f8-8fa7-b1fae54942f3@www.fastmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

In a Hacker News discussion [2] on using foreign keys for joins,
the author of PostgREST, Steve Chavez, mentioned they are actually already
using this idea in PostgREST:

Steve Chavez wrote:
>The idea about using FK as a JOIN target is interesting.
>While developing a syntax for PostgREST resource embedding[1],
>I also reached the conclusion that FKs would be a convenient way to join tables
>(also suggested renaming them as you do here).
>
>IIRC, self joins are still an issue with FK joining.
>
>[1]: https://postgrest.org/en/v7.0.0/api.html#embedding-disambiguation

I think this idea looks very promising and fruitful.

Maybe we can think of some other existing/new operator which would be acceptable,
instead of using "->" (which is potentially in conflict with the SQL standard's "REF" thing)?

Not saying we should move forward on our own with this idea,
but if we can come up with a complete proposal,
maybe it can be presented as an idea to the SQL committee?

[2] https://news.ycombinator.com/item?id=26693705

/Joel

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Etsuro Fujita 2021-04-06 08:45:39 Re: Asynchronous Append on postgres_fdw nodes.
Previous Message Amit Langote 2021-04-06 07:46:26 Re: A reloption for partitioned tables - parallel_workers