Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bpvtw-0008VM-Bv for pgsql-performance@arkaria.postgresql.org; Fri, 30 Sep 2016 11:22:48 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84_2) (envelope-from ) id 1bpvtv-0000Nt-QA for pgsql-performance@arkaria.postgresql.org; Fri, 30 Sep 2016 11:22:47 +0000 Received: from makus.postgresql.org ([2001:4800:1501:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1bpvtu-0000N6-Fy for pgsql-performance@postgresql.org; Fri, 30 Sep 2016 11:22:46 +0000 Received: from shout02.mail.de ([2001:868:100:600::217]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1bpvtq-0002W8-Vy for pgsql-performance@postgresql.org; Fri, 30 Sep 2016 11:22:44 +0000 Received: from postfix03.mail.de (postfix03.bt.mail.de [10.0.121.127]) by shout02.mail.de (Postfix) with ESMTP id 5AF515FF1C for ; Fri, 30 Sep 2016 13:22:40 +0200 (CEST) Received: from smtp04.mail.de (smtp04.bt.mail.de [10.0.121.214]) by postfix03.mail.de (Postfix) with ESMTP id 4592840197 for ; Fri, 30 Sep 2016 13:22:40 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=mail.de; s=mail201212; t=1475234560; bh=Y2a2yZh2mO0+u0M87FPWbsRGHLe3cCYokkh9mfr1Ngw=; h=Subject:To:References:From:Date:In-Reply-To:From; b=fDp+Kjca0GwBopfkTNlrEmRqlZ/ujbMtke2JqbYxBcadGOcn2vnxwdgH6EULRkdYX h7ubOfzwxejin9tfwEUWazfvHvfDqLc8tpG0u7pnOhnQFC1Ufx50EcWHcxTmcP+NfV xUvUXWLiEDourB2oW+7N1fbc84xKq8lUXxASx5CE= Received: from [127.0.0.1] (localhost [127.0.0.1]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by smtp04.mail.de (Postfix) with ESMTPSA id 16FFB8010E for ; Fri, 30 Sep 2016 13:22:39 +0200 (CEST) Subject: Re: Multiple-Table-Spanning Joins with ORs in WHERE Clause To: pgsql-performance@postgresql.org References: <97dbd6f9-a289-94d1-325f-997df87c672a@mail.de> <0e86e399-61dc-8e78-415e-c83db9592a80@mail.de> From: "Sven R. Kunze" Message-ID: Date: Fri, 30 Sep 2016 13:22:44 +0200 MIME-Version: 1.0 In-Reply-To: Content-Type: multipart/alternative; boundary="------------D084C884BFFF0E9CE270B244" X-purgate: clean X-purgate: This mail is considered clean (visit http://www.eleven.de for further information) X-purgate-type: clean X-purgate-Ad: Categorized by eleven eXpurgate (R) http://www.eleven.de X-purgate: This mail is considered clean (visit http://www.eleven.de for further information) X-purgate: clean X-purgate-size: 5290 X-purgate-ID: 154282::1475234560-00000836-5E75BB27/0/0 X-Pg-Spam-Score: -5.7 (-----) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-performance Precedence: bulk Sender: pgsql-performance-owner@postgresql.org This is a multi-part message in MIME format. --------------D084C884BFFF0E9CE270B244 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit On 29.09.2016 22:26, Jeff Janes wrote: > 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. Understood. > > 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. Not suddenly but gradually. Data can change and we don't know for sure how people will use our systems in the future. Hence, another plan would be more optimal or even a seq scan on big_table would be faster. In the case at hand, I doubt it but you never know. > 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). I have been thinking about this. It would be an interesting exercise as I haven't written much of C in the last decade but sometimes one needs to get out of the comfort zone to get things going. Sven --------------D084C884BFFF0E9CE270B244 Content-Type: text/html; charset=utf-8 Content-Transfer-Encoding: 8bit
On 29.09.2016 22:26, Jeff Janes wrote:
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.

Understood.

 

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.

Not suddenly but gradually. Data can change and we don't know for sure how people will use our systems in the future. Hence, another plan would be more optimal or even a seq scan on big_table would be faster.

In the case at hand, I doubt it but you never know.

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).

I have been thinking about this. It would be an interesting exercise as I haven't written much of C in the last decade but sometimes one needs to get out of the comfort zone to get things going.


Sven
--------------D084C884BFFF0E9CE270B244--