Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1n9Ygu-0003Ai-E8 for pgsql-hackers@arkaria.postgresql.org; Mon, 17 Jan 2022 20:33:25 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1n9YgN-0002f7-An for pgsql-hackers@arkaria.postgresql.org; Mon, 17 Jan 2022 20:32:51 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1n9YgM-0002ey-Ut for pgsql-hackers@lists.postgresql.org; Mon, 17 Jan 2022 20:32:51 +0000 Received: from mxout1.routing.net ([2a03:2900:1:a::a]) by magus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1n9YgI-0006jN-RN for pgsql-hackers@postgresql.org; Mon, 17 Jan 2022 20:32:50 +0000 Received: from mxbox4.masterlogin.de (unknown [192.168.10.79]) by mxout1.routing.net (Postfix) with ESMTP id 7EC424029B; Mon, 17 Jan 2022 20:32:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=mailerdienst.de; s=20200217; t=1642451564; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=A2Rv7OnQeWxwLCwcjOCF4UnLjrMiMO4+PZ2aJdXXuPc=; b=DAUHlIdkt+zX620Z2Ydivk8tVNmRl+Q7rzms59D0atdOnk2m92Nyhyh7r1ImALhkl50f9c S0D5zhqnIX7rIaP5YH0tu6pdoIKXYJ21jLjZvcIFZRixvfdNN0i1fYBbS1pKWJFmCG/dti d4Z48OhzGSzftbyDSJ+C7Hl0VK6cdUg= Received: from remote.index.de (i68970D96.versanet.de [104.151.13.150]) by mxbox4.masterlogin.de (Postfix) with ESMTPSA id 0C5B680696; Mon, 17 Jan 2022 20:32:44 +0000 (UTC) Received: from acedia.index-gruppe.local (192.168.54.121) by invidia.index-gruppe.local (192.168.54.140) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2308.21; Mon, 17 Jan 2022 21:32:40 +0100 Received: from acedia.index-gruppe.local ([fe80::501:b638:b4b6:57d1]) by acedia.index-gruppe.local ([fe80::501:b638:b4b6:57d1%13]) with mapi id 15.01.2308.021; Mon, 17 Jan 2022 21:32:40 +0100 From: Arne Roland To: Alvaro Herrera CC: Julien Rouhaud , pgsql-hackers Subject: Re: missing indexes in indexlist with partitioned tables Thread-Topic: missing indexes in indexlist with partitioned tables Thread-Index: AQHXsJoeXw6ojQG4NkOLdiX4KUBdD6vkTOpcgIAWJQCAA2SO7oAAbRh////16wCAADDYxQ== Date: Mon, 17 Jan 2022 20:32:40 +0000 Message-ID: <2641568c18de40e8b1528fc9d4d80127@index.de> References: <405b11a5a0504b76b997e312e543a69b@index.de>,<202201171816.r6tkrn7drkm3@alvherre.pgsql> In-Reply-To: <202201171816.r6tkrn7drkm3@alvherre.pgsql> Accept-Language: en-US, de-DE Content-Language: en-US X-MS-Has-Attach: yes X-MS-TNEF-Correlator: x-originating-ip: [10.255.1.33] Content-Type: multipart/mixed; boundary="_004_2641568c18de40e8b1528fc9d4d80127indexde_" MIME-Version: 1.0 X-Mail-ID: e0081ce7-232e-4e6a-ad5f-c9e2afcdad5c List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk --_004_2641568c18de40e8b1528fc9d4d80127indexde_ Content-Type: multipart/alternative; boundary="_000_2641568c18de40e8b1528fc9d4d80127indexde_" --_000_2641568c18de40e8b1528fc9d4d80127indexde_ Content-Type: text/plain; charset="Windows-1252" Content-Transfer-Encoding: quoted-printable Hi! Afaiac the join pruning where the outer table is a partitioned table is the= relevant case. I am not sure whether there are other cases. The join pruning, which works great for plain relations since 9.0, falls sh= ort for partitioned tables, since the optimizer fails to prove uniqueness t= here. In practical cases inner and outer tables are almost surely different ones,= but I reattached a simpler example. It's the one, I came up with back in S= eptember. I've seen this can be a reason to avoid partitioning for the time being, if= the application relies on join pruning. I think generic views make it almo= st necessary to have it. If you had a different answer in mind, please don'= t hesitate to ask again. Regards Arne ________________________________ From: Alvaro Herrera Sent: Monday, January 17, 2022 7:16:08 PM To: Arne Roland Cc: Julien Rouhaud; pgsql-hackers Subject: Re: missing indexes in indexlist with partitioned tables Hmm, can you show cases of queries for which having this new partIndexlist changes plans? -- =C1lvaro Herrera PostgreSQL Developer =97 https://www.EnterpriseD= B.com/ "Saca el libro que tu religi=F3n considere como el indicado para encontrar = la oraci=F3n que traiga paz a tu alma. Luego rebootea el computador y ve si funciona" (Carlos Ducl=F3s) --_000_2641568c18de40e8b1528fc9d4d80127indexde_ Content-Type: text/html; charset="Windows-1252" Content-Transfer-Encoding: quoted-printable

Hi!

Afaiac the join pruning where the outer table is a partitioned table is the= relevant case.

I am not sure whether there are other cases.
The join pruning, which works great for plain relations since 9.0, falls sh= ort for partitioned tables, since the optimizer fails to prove uniqueness t= here.


In practical cases inner and outer tables are almost surely different on= es, but I reattached a simpler example. It's the one, I came up with back i= n September.

I've seen this can be a reason to avoid partitioning for the time being,= if the application relies on join pruning. I think generic views make it a= lmost necessary to have it. If you had a different answer in mind, please d= on't hesitate to ask again.


Regards
Arne



From: Alvaro Herrera <= alvherre@alvh.no-ip.org>
Sent: Monday, January 17, 2022 7:16:08 PM
To: Arne Roland
Cc: Julien Rouhaud; pgsql-hackers
Subject: Re: missing indexes in indexlist with partitioned tables
 
Hmm, can you show cases of queries for which havin= g this new
partIndexlist changes plans?

--
=C1lvaro Herrera         PostgreSQL= Developer  =97  https://www.EnterpriseDB.com/
"Saca el libro que tu religi=F3n considere como el indicado para encon= trar la
oraci=F3n que traiga paz a tu alma. Luego rebootea el computador
y ve si funciona" (Carlos Ducl=F3s)



--_000_2641568c18de40e8b1528fc9d4d80127indexde_-- --_004_2641568c18de40e8b1528fc9d4d80127indexde_ Content-Type: application/sql; name="indexlist_to_late.sql" Content-Description: indexlist_to_late.sql Content-Disposition: attachment; filename="indexlist_to_late.sql"; size=296; creation-date="Mon, 17 Jan 2022 20:17:24 GMT"; modification-date="Mon, 17 Jan 2022 20:17:24 GMT" Content-Transfer-Encoding: base64 Y3JlYXRlIHRhYmxlIHB1YmxpYy5hIChpZCBiaWdpbnQgbm90IG51bGwgcHJpbWFyeSBrZXkpIHBh cnRpdGlvbiBieSByYW5nZSAoaWQpOwpjcmVhdGUgdGFibGUgYiBwYXJ0aXRpb24gb2YgYSBmb3Ig dmFsdWVzIGZyb20gKDApIHRvICgxMDAwKTsKCi0tIHdvcmtzIGFzIGV4cGVjdGVkCmV4cGxhaW4g c2VsZWN0IGEuaWQgZnJvbSBhIGxlZnQgam9pbiBiIHVzaW5nIChpZCk7Ci0tIGluZGV4bGlzdCBp cyBzZXQgdG8gbGF0ZQpleHBsYWluIHNlbGVjdCBhLmlkIGZyb20gYSBsZWZ0IGpvaW4gYSBhMSB1 c2luZyAoaWQpOwo= --_004_2641568c18de40e8b1528fc9d4d80127indexde_--