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

From: Andrew Dunstan <andrew(at)dunslane(dot)net>
To: Alvaro Herrera <alvherre(at)alvh(dot)no-ip(dot)org>, Joel Jacobson <joel(at)compiler(dot)org>
Cc: pgsql-hackers(at)lists(dot)postgresql(dot)org
Subject: Re: Idea: Avoid JOINs by using path expressions to follow FKs
Date: 2021-03-28 13:23:13
Message-ID: bfe7134b-f3c4-3195-7c01-55f78a9ae092@dunslane.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers


On 3/27/21 5:11 PM, Alvaro Herrera wrote:
> On 2021-Mar-27, Joel Jacobson wrote:
>
>> If there would be multiple foreign keys on a column we try to follow,
>> the query planner would throw an error forcing the user to use explicit joins instead.
> This seems pretty dangerous -- you just have to create one more FK, and
> suddenly a query that worked perfectly fine, now starts throwing errors
> because it's now ambiguous. Feels a bit like JOIN NATURAL, which many
> people discourage because of this problem.
>

Maybe. I don't recall ever having seen a column with more than one FK.
Is that a common thing? In itself it seems like a bad idea.

Not saying I think this suggestion is a good idea, though. We've seen
many frameworks that hide joins, and the results are ... less than
universally good. If your application programmers don't like using
joins, then either a) you should have the DBA create some views for them
that contain the joins, or b) you have the wrong application programmers -:)

cheers

andrew

--
Andrew Dunstan
EDB: https://www.enterprisedb.com

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Andrew Dunstan 2021-03-28 13:29:10 Re: invalid data in file backup_label problem on windows
Previous Message Julien Rouhaud 2021-03-28 13:22:07 Re: [PATCH] Hooks at XactCommand level