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 1juKiu-0002Kz-PA for pgsql-general@arkaria.postgresql.org; Sat, 11 Jul 2020 18:59:44 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1juKir-0006Oe-GV for pgsql-general@arkaria.postgresql.org; Sat, 11 Jul 2020 18:59:41 +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 1juKir-0006OX-6u for pgsql-general@lists.postgresql.org; Sat, 11 Jul 2020 18:59:41 +0000 Received: from mxh01aws49.mxout.inova.com.br ([34.198.242.49] helo=mxhero01.a.inova.com.br) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1juKif-000264-J5 for pgsql-general@lists.postgresql.org; Sat, 11 Jul 2020 18:59:39 +0000 Received: from MXHERO01.A.INOVA.COM.BR (localhost [127.0.0.1]) by mxhero01.a.inova.com.br (Postfix) with ESMTP id 170814C647 for ; Sat, 11 Jul 2020 18:59:27 +0000 (UTC) Received: from mxhero01.a.inova.com.br (localhost [127.0.0.1]) by mxhero01.a.inova.com.br (Postfix) with ESMTP; Sat, 11 Jul 2020 18:59:27 +0000 (UTC) Received: from mxhero02.a.inova.com.br (ip-10-0-4-48.ec2.internal [10.0.4.48]) by mxhero01.a.inova.com.br (Postfix) with ESMTPS id F23A54014F; Sat, 11 Jul 2020 18:59:26 +0000 (UTC) Received: from corpmoutpolicyd01.a.inova.com.br (puppetmaster.a.inova.com.br [10.0.1.88]) by mxhero02.a.inova.com.br (Postfix) with ESMTP id DFF2818E22D; Sat, 11 Jul 2020 18:59:26 +0000 (UTC) Received: from corpmoutpolicyd01.a.inova.com.br (localhost [127.0.0.1]) by corpmoutpolicyd01.a.inova.com.br (Postfix) with ESMTP id D77E3220404; Sat, 11 Jul 2020 15:59:24 -0300 (BRT) Received: from corpmout01.a.inova.com.br (ip-10-0-1-125.ec2.internal [10.0.1.125]) by corpmoutpolicyd01.a.inova.com.br (Postfix) with ESMTP id CDC51AAF86; Sat, 11 Jul 2020 15:59:24 -0300 (BRT) Received: from corpmbox02.a.inova.com.br (ip-10-0-4-158.ec2.internal [10.0.4.158]) by corpmout01.a.inova.com.br (Postfix) with ESMTP; Sat, 11 Jul 2020 15:59:24 -0300 (-03) Date: Sat, 11 Jul 2020 15:59:24 -0300 (BRT) From: luis.roberto@siscobra.com.br To: =?utf-8?Q?Fabr=C3=ADzio?= de Royes Mello Cc: pgsql-general Message-ID: <1436239160.11622485.1594493964776.JavaMail.zimbra@siscobra.com.br> In-Reply-To: References: <2028783297.11609965.1594488024498.JavaMail.zimbra@siscobra.com.br> Subject: Re: Join optimization MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="=_5734fefe-b334-403c-96ad-57f1af73e7d2" X-Originating-IP: [10.0.1.247] X-Mailer: Zimbra 8.8.15_GA_3918 (ZimbraWebClient - GC83 (Win)/8.8.15_GA_3895) Thread-Topic: Join optimization Thread-Index: caOMa6Zl4RzvVo81aF2LaCD+W9qnmw== X-CMAE-Score: 0 X-CMAE-Analysis: v=2.2 cv=H8qr+6Qi c=1 sm=1 tr=0 cx=a_idp_d a=aVKa9x/uM93/m3V8yChZ6A==:117 a=FKkrIqjQGGEA:10 a=_uFG4AKbl_AA:10 a=_RQrkK6FrEwA:10 a=h2mZ7ym4DuMA:10 a=W2qJBIc1AAAA:8 a=VSGBPb8XAAAA:8 a=m19YD-nRAAAA:8 a=epTmVMiNAAAA:8 a=7k2oeKubobxOWdnVPgkA:9 a=x3C5D3LuN8TfnUVr:21 a=HlMRlQJQNu4EskZ7:21 a=QEXdDO2ut3YA:10 a=WNRlz2rfyblu59KrTKoA:9 a=eDNDRIIrOqBCpLLd:21 a=2ZS5aS1JuxVsELng:21 a=3TeAPAX-NZpuogeC:21 a=_W_S_7VecoQA:10 a=f3LCGml2-gjdAfozEohe:22 a=r-vnRQDpo0Mhf4Iua1vZ:22 a=FnJ2BL13HOe6lA8RQuFj:22 a=ndEWmUVY6Yapc0oHF_P4:22 x-mxHero-Origin-Ip: /127.0.0.1:42442 X-mxHero-AttachmentBlock: rule=48;result=false List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk --=_5734fefe-b334-403c-96ad-57f1af73e7d2 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable I'm sorry for the bad example.=20 Here is another, with some data on PG: [ https://dbfiddle.uk/?rdbms=3Dpostg= res_13&fiddle=3Dccfd1c4fa291e74a6db9db1772e2b5ac | https://dbfiddle.uk/?rdb= ms=3Dpostgres_13&fiddle=3Dccfd1c4fa291e74a6db9db1772e2b5ac ] and Oracle: [ = https://dbfiddle.uk/?rdbms=3Doracle_18&fiddle=3D21a98f499065ad4e2c35ff4bd14= 87e14 | https://dbfiddle.uk/?rdbms=3Doracle_18&fiddle=3D21a98f499065ad4e2c3= 5ff4bd1487e14 ] .=20 I don't understand oracle's execution plan very well, but it doesn't seem t= o be hitting the Users table...=20 De: "Fabr=C3=ADzio de Royes Mello" =20 Para: "luis.roberto" =20 Cc: "pgsql-general" =20 Enviadas: S=C3=A1bado, 11 de julho de 2020 15:24:04=20 Assunto: Re: Join optimization=20 Em s=C3=A1b, 11 de jul de 2020 =C3=A0s 14:20, < [ mailto:luis.roberto@sisco= bra.com.br | luis.roberto@siscobra.com.br ] > escreveu:=20 Hi!=20 Recently on a blogpost [1] I saw that Oracle was able to "optimize" a join = strategy by completely eliminating access to a table.=20 Heres the execution on Oracle 18c [2] and PostgreSQL 13 (beta) [3].=20 Is there a fundamental reason why PG can't do the same?=20 It does... did you see the =E2=80=9Cnever executed=E2=80=9D notice on the P= ostgres explain output?=20 Regards,=20 BQ_BEGIN BQ_END --=20 Fabr=C3=ADzio de Royes Mello Timbira - [ http://www.timbira.com.br/ | http:= //www.timbira.com.br/ ]=20 PostgreSQL: Consultoria, Desenvolvimento, Suporte 24x7 e Treinamento=20 --=_5734fefe-b334-403c-96ad-57f1af73e7d2 Content-Type: text/html; charset=utf-8 Content-Transfer-Encoding: quoted-printable
I'm sorry for t= he bad example.


I don'= t understand oracle's execution plan very well, but it doesn't seem to be h= itting the Users table...


De: "Fabr=C3=ADzio= de Royes Mello" <fabrizio@timbira.com.br>
Para: "luis.robe= rto" <luis.roberto@siscobra.com.br>
Cc: "pgsql-general" <= ;pgsql-general@lists.postgresql.org>
Enviadas: S=C3=A1bado, 11= de julho de 2020 15:24:04
Assunto: Re: Join optimization


Em s=C3=A1b, 11 de j= ul de 2020 =C3=A0s 14:20, <luis.roberto@siscobra.com.br> escreveu:
Hi!

Recent= ly on a blogpost [1] I saw that Oracle was able to "optimize" a join strate= gy by completely eliminating access to a table.

Heres the execution on Oracle 18= c [2] and PostgreSQL 13 (beta) [3].

Is there a fundamental re= ason why PG can't do the same? 

It does... did you see the =E2=80=9Cn= ever executed=E2=80=9D notice on the Postgres explain output?

Regards,

<= /div>

--
   Fabr=C3=ADzio de Royes Me= llo         Timbira - http://www.timbira.com.br/
   Post= greSQL: Consultoria, Desenvolvimento, Suporte 24x7 e Treinamento

--=_5734fefe-b334-403c-96ad-57f1af73e7d2--