Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1qusfK-001zTo-JN for pgsql-hackers@arkaria.postgresql.org; Mon, 23 Oct 2023 11:00:10 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.94.2) (envelope-from ) id 1qusfI-0082yO-HM for pgsql-hackers@arkaria.postgresql.org; Mon, 23 Oct 2023 11:00:09 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1qusfI-0082yF-5p for pgsql-hackers@lists.postgresql.org; Mon, 23 Oct 2023 11:00:08 +0000 Received: from mail-lj1-x22e.google.com ([2a00:1450:4864:20::22e]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.94.2) (envelope-from ) id 1qusfD-002F1n-S0 for pgsql-hackers@lists.postgresql.org; Mon, 23 Oct 2023 11:00:08 +0000 Received: by mail-lj1-x22e.google.com with SMTP id 38308e7fff4ca-2c16757987fso45641251fa.3 for ; Mon, 23 Oct 2023 04:00:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1698058803; x=1698663603; darn=lists.postgresql.org; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :from:to:cc:subject:date:message-id:reply-to; bh=R9UZT6zZVZb56096YAQJVPU2WszLIGGeSmzrSL7wFbY=; b=mj+5lwzfCT+HY0tkOgcgFqsNkshApDkgB337NrnUK/aymS8Vkk4gYd/prFCo2IxZP2 PS9dEilNIOu4H4tUe/q5P2dW53uNx23MfQkxV95bunhK4FnvyUv9N8M/df/GiMPfzqWX WVBqPVPHVgdDT++qHaADM6XvPRLCKtxgHf86I3iT/T8X1McAF/8I06BxVfV0zZDPIS45 2JSSOuNYv3UQ6YJ7F3csWSfh/Vi6Vvr603DD288otP9ivme83HXC4afpt5x4TsRZa2OK w2biu8ZNsnWQbNVsGdaWaA4AYJeWqLNI+HMX4/C3L9O7wPZXvsGVfkZgDlnrX0sfQGpF xu/Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1698058803; x=1698663603; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=R9UZT6zZVZb56096YAQJVPU2WszLIGGeSmzrSL7wFbY=; b=WfMMandeVkSFveH9t9tLPq1CPHoBv6BSbT34Q6Wfoal6GnkA+uwPqr9z88tTeYUrhN N4gZp1FqcVuaHW5pe+/UvsJusfB0jk9z4jJFAuFpXgFLTxa3PiNHYaCjmsXVPsGP3XPT 2bZcRzgLV2L/hzUHdiL1m3ML3Iy1a1grAXUM4c1V5q1YrtxZQwYomHoJJ0RLXbyr8F/h bCD0or3NsWOQR7dO74lVghR8aJM7puWjWvGYGrcfiDCF2dhsxMWnG30uuGdUoyfeu/XD LnTilv9SkKnRlrQK/nRTbvAZ1OOw4Mgxjq+jm12jahCtKRPMlGhk6iM3mLLpDh523g6y rdRQ== X-Gm-Message-State: AOJu0YwGU/oRc/gR6QMEsLeS/fKxzbdh4hOGxSf/Nqpsnx0YPTBmrJqU GU1HNb0B76Uq/mxME4CWnAo= X-Google-Smtp-Source: AGHT+IEIi50aZwuwoNnQj6hcvAVq7P51GKrf0KnJonUy3H3h/gS8joZ3C6Lc/qoPG6CZdlLNDTrDVw== X-Received: by 2002:a2e:9210:0:b0:2bf:f7ea:884a with SMTP id k16-20020a2e9210000000b002bff7ea884amr6264919ljg.30.1698058802566; Mon, 23 Oct 2023 04:00:02 -0700 (PDT) Received: from [1.0.0.7] ([178.155.28.40]) by smtp.gmail.com with ESMTPSA id c15-20020a2e680f000000b002c504d8260esm1543402lja.24.2023.10.23.04.00.01 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 23 Oct 2023 04:00:01 -0700 (PDT) Message-ID: <107682e0-137a-d0fb-2733-7fc6e9562690@gmail.com> Date: Mon, 23 Oct 2023 14:00:00 +0300 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.4.2 Subject: Re: Removing unneeded self joins Content-Language: en-US To: Alexander Korotkov , Andrei Lepikhov Cc: "Gregory Stark (as CFM)" , =?UTF-8?Q?Micha=c5=82_K=c5=82eczek?= , PostgreSQL Hackers References: <64486b0b-0404-e39e-322d-0801154901f3@postgrespro.ru> <05469e80-454b-41d7-d04f-421f42bbd4a9@postgrespro.ru> <48c11b23-9c23-440e-9a3c-020e05196449@postgrespro.ru> <8800ccf2-ae82-461c-92a1-d4c0a22f8cf2@postgrespro.ru> <1bd80083-a13e-4e9f-a7ce-73c3faab521c@postgrespro.ru> <922623af-872e-4cdc-9238-129b18bee42d@postgrespro.ru> From: Alexander Lakhin In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Hi Alexander, 23.10.2023 12:47, Alexander Korotkov wrote: > I think this patch makes substantial improvement to query planning. > It has received plenty of reviews. The code is currently in quite > good shape. I didn't manage to find the cases when this optimization > causes significant overhead to planning time. Even if such cases will > be spotted there is a GUC option to disable this feature. So, I'll > push this if there are no objections. On a quick glance, I've noticed following typos/inconsistencies in the patch, which maybe worth fixing: s/cadidates/candidates/ s/uniquiness/uniqueness/ s/selfjoin/self-join/ s/seperate/separate/ Also, shouldn't the reference "see generate_implied_equalities" be "see generate_implied_equalities_for_column"? Best regards, Alexander