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 1nAIHO-0000AK-Tc for pgsql-hackers@arkaria.postgresql.org; Wed, 19 Jan 2022 21:14:07 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1nAIHN-0003Fi-OO for pgsql-hackers@arkaria.postgresql.org; Wed, 19 Jan 2022 21:14:05 +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 1nAIHN-0003FV-C8 for pgsql-hackers@lists.postgresql.org; Wed, 19 Jan 2022 21:14:05 +0000 Received: from mxout2.routing.net ([2a03:2900:1:a::b]) by magus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1nAIHK-0005AO-Pc for pgsql-hackers@postgresql.org; Wed, 19 Jan 2022 21:14:05 +0000 Received: from mxbox3.masterlogin.de (unknown [192.168.10.78]) by mxout2.routing.net (Postfix) with ESMTP id E1ACD5FCA4; Wed, 19 Jan 2022 21:13:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=mailerdienst.de; s=20200217; t=1642626840; 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=zlj7U1cH/dd6cmZlnQypCcdQJyfoYXRakR9xdlu/HbM=; b=M33+ZEWaSxAQx59fvy68WKWnsqJ2Z5e4oZP40Oq7PKzxNW4Pbp0KcTl0lyYOc5cq0sMy0b xkuKvLPqiMSieTR2togiWpgkxqIjDm3TEhMZu7obDBrsni3x/mCdHcSnweQfXprJHDdNFP KhfUNuzuXR2odk5Ez74gJgNowH2/5BI= Received: from remote.index.de (i68970D96.versanet.de [104.151.13.150]) by mxbox3.masterlogin.de (Postfix) with ESMTPSA id 707AD3602F1; Wed, 19 Jan 2022 21:13:59 +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; Wed, 19 Jan 2022 22:13:56 +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; Wed, 19 Jan 2022 22:13:55 +0100 From: Arne Roland To: Alvaro Herrera , Julien Rouhaud CC: pgsql-hackers Subject: Re: missing indexes in indexlist with partitioned tables Thread-Topic: missing indexes in indexlist with partitioned tables Thread-Index: AQHXsJoeXw6ojQG4NkOLdiX4KUBdD6vkTOpcgIAWJQCAA2SO7oAAbRh////16wCAADDYxYAAo/oAgABsDQCAAiIn7g== Date: Wed, 19 Jan 2022 21:13:55 +0000 Message-ID: <225acbe1b6e242df8025ea6e75de2158@index.de> References: <20220118065750.v5zigpuisljc6jmk@jrouhaud>,<202201181324.idvthmrhbtf5@alvherre.pgsql> In-Reply-To: <202201181324.idvthmrhbtf5@alvherre.pgsql> Accept-Language: en-US, de-DE Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [10.255.1.33] Content-Type: multipart/alternative; boundary="_000_225acbe1b6e242df8025ea6e75de2158indexde_" MIME-Version: 1.0 X-Mail-ID: 2ae5531a-624b-4193-a6a2-2e790636d96a List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk --_000_225acbe1b6e242df8025ea6e75de2158indexde_ Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Hi! > From: Alvaro Herrera > [...] > Hmm, these plan changes look valid to me. A left self-join using the > primary key column? That looks optimizable all right. > [...] > What I still don't know is whether this patch is actually desirable or > not. If the only cases it affects is self-joins, is there much actual > value? This is not really about self joins. That was just the most simple example,= because otherwise we need a second table. It's unique, it's not relevant whether it's the same table. In most cases i= t won't. I was talking about join pruning. > I suspect that the author of partition-wise joins would want to change > these queries so that whatever was being tested by these self-joins is > tested by some other means (maybe just create an identical partitioned > table via CREATE TABLE fract_t2 ... ; INSERT INTO fract_t2 SELECT FROM > fract_t). But at the same time, the author of this patch should Your suggestion doesn't work, because with my patch we solve that case as w= ell. We solve the general join pruning case. If we make the index non-uniqu= e however, we should be able to test the fractional case the same way. > b) add some test cases to verify that his desired > behavior is tested somewhere, not just in a test case that's > incidentally broken by his patch. My patch already includes such a test, look at @@ -90,6 +90,13 @@ src/test/= regress/sql/partition_join.sql Since the selfjoin part was confusing to you, it might be worthwhile to do = test that with two different tables. While I see no need to test in that wa= y, I will adjust the patch so. Just to make it more clear for people lookin= g at those tests in the future. a) make > sure that the submitted patch updates these test results so that the > test pass [...] Just for the record: I did run the tests, but I did miss that the commit of= Tomas fix for fractional optimization is already on the master. Please not= e that this is a very new test case from a patch committed less than one we= ek ago. I'm glad Julien Rouhaud pointed out, that Tomas patch is committed it by no= w. That was very helpful to me, as I can now integrate the two tests. @=C1lvaro Herrera: If you want to help me, please don't put forward an abstract list of respon= sibilities. If anything I obviously need practical help, on how I can catch= on recent changes quicker and without manual intervention. I don't have a = modified buildfarm animal running, that tries to apply my patch and run reg= ression tests for my patch on a daily basis. Is there a simple way for me to check for that? I will probably integrate those two tests, since they can work of similar s= tructures without need to recreate the tables again and again. I have clear= understanding how that new test works. I have to attend a few calls now, b= ut I should be able to update the tests later. Regards Arne --_000_225acbe1b6e242df8025ea6e75de2158indexde_ Content-Type: text/html; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable

Hi!

> From: Alvaro Herrera <alvherre@alvh.no-ip.org>
> [...]
> Hmm, these plan changes look valid to me.  A left self-join using= the
> primary key column?  That looks optimizable all right.
> [...]
> What I still don't know is whether this patch is actually desirable or=
> not.  If the only cases it affects is self-joins, is there much a= ctual
> value?

This is not really about self joins. That was just the most simple example,= because otherwise we need a second table.
It's unique, it's not relevant whether it's the same table. In most cases i= t won't. I was talking about join pruning.

> I suspect that the author of partition-wise joins would want to c= hange
> these queries so that whatever was being tested by these self-joins is=
> tested by some other means (maybe just create an identical partitioned=
> table via CREATE TABLE fract_t2 ... ; INSERT INTO fract_t2 SELECT FROM=
> fract_t).  But at the same time, the author of this patch should<= br>
Your suggestion doesn't work, because with my patch we solve that case as w= ell. We solve the general join pruning case. If we make the index non-uniqu= e however, we should be able to test the fractional case the same way.

> b) add some test cases to verify that his desired
> behavior is tested somewhere, not just in a test case that's
> incidentally broken by his patch.

My patch already includes such a test, look at @@ -90,6 +90,13 @@ src/t= est/regress/sql/partition_join.sql
Since the selfjoin part was confusing to you, it might be worthwhile t= o do test that with two different tables. While I see no need to test in th= at way, I will adjust the patch so. Just to make it more clear for people l= ooking at those tests in the future.

a) make
> sure that the submitted patch updates these test results so that = the
> test pass [...]

Just for the record: I did run the tests, but I did miss that the commit of= Tomas fix for fractional optimization is already on the master. Please not= e that this is a very new test case from a patch committed less than one we= ek ago.

I'm glad Julien Rouhaud pointed out, that Tomas patch is committed it by no= w. That was very helpful to me, as I can now integrate the two tests.

@=C1lvaro Herrera:
If you want to help me, please don't put forward an abstract list of respon= sibilities. If anything I obviously need practical help, on how I can catch= on recent changes quicker and without manual intervention. I don't have a = modified buildfarm animal running, that tries to apply my patch and run regression tests for my patch on a da= ily basis.
Is there a simple way for me to check for that?

I will probably integrate those two tests, since they can work of similar s= tructures without need to recreate the tables again and again. I have clear= understanding how that new test works. I have to attend a few calls now, b= ut I should be able to update the tests later.

Regards
Arne

--_000_225acbe1b6e242df8025ea6e75de2158indexde_--