Re: Multiple-Table-Spanning Joins with ORs in WHERE Clause

From: Jeff Janes <jeff(dot)janes(at)gmail(dot)com>
To: "Sven R(dot) Kunze" <srkunze(at)mail(dot)de>
Cc: "pgsql-performance(at)postgresql(dot)org" <pgsql-performance(at)postgresql(dot)org>
Subject: Re: Multiple-Table-Spanning Joins with ORs in WHERE Clause
Date: 2016-09-29 20:26:09
Message-ID: CAMkU=1xDzevE2sUY8GBcrA50_ivvdw5tQHk9OzT0-4MkcbfYKw@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-performance

On Thu, Sep 29, 2016 at 11:48 AM, Sven R. Kunze <srkunze(at)mail(dot)de> wrote:

> On 29.09.2016 20:03, Jeff Janes wrote:
>
> Perhaps some future version of PostgreSQL could do so, but my gut feeling
> is that that is not very likely. It would take a lot of work, would risk
> breaking or slowing down other things, and is probably too much of a niche
> issue to attract a lot of interest.
>
>
> I don't hope so; in business and reports/stats applications there is a lot
> of room for this.
>
> Why do you think that OR-ing several tables is a niche issue? I can at
> least name 3 different projects (from 3 different domains) where combining
> 3 or more tables with OR is relevant and should be reasonably fast.
>

Well, I don't recall seeing this issue on this list before (or a few other
forums I read) while I see several other issues over and over again. So
that is why I think it is a niche issue. Perhaps I've have seen it before
and just forgotten, or have not recognized it as being the same issue each
time.

> This multitude of solution also shows that applications developers might
> be overwhelmed by choosing the most appropriate AND most long-lasting one.
> Because what I take from the discussion is that a UNION might be
> appropriate right now but that could change in the future even for the very
> same use-case at hand.
>

I'm not sure what would cause it to change. Do you mean if you suddenly
start selecting a much larger portion of the table? I don't know that the
union would be particularly bad in that case, either.

I'm not saying it wouldn't be nice to fix it. I just don't think it is
particularly likely to happen soon. I could be wrong (especially if you
can write the code to make it happen).

Cheers,

Jeff

In response to

Responses

Browse pgsql-performance by date

  From Date Subject
Next Message Jeff Janes 2016-09-29 20:35:33 Re: Multiple-Table-Spanning Joins with ORs in WHERE Clause
Previous Message Pavel Stehule 2016-09-29 19:11:34 Re: Multiple-Table-Spanning Joins with ORs in WHERE Clause