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 1sViYv-00BHpY-V2 for pgsql-hackers@arkaria.postgresql.org; Mon, 22 Jul 2024 02:14:05 +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 1sViYu-00DsdA-0D for pgsql-hackers@arkaria.postgresql.org; Mon, 22 Jul 2024 02:14:04 +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 1sViYt-00Dsd2-Kj for pgsql-hackers@lists.postgresql.org; Mon, 22 Jul 2024 02:14:04 +0000 Received: from mail-pg1-x52f.google.com ([2607:f8b0:4864:20::52f]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.94.2) (envelope-from ) id 1sViYn-000nQp-UW for pgsql-hackers@lists.postgresql.org; Mon, 22 Jul 2024 02:14:03 +0000 Received: by mail-pg1-x52f.google.com with SMTP id 41be03b00d2f7-7669d62b5bfso2196148a12.1 for ; Sun, 21 Jul 2024 19:13:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1721614436; x=1722219236; darn=lists.postgresql.org; h=content-transfer-encoding:in-reply-to:content-language:references :cc:to:subject:from:user-agent:mime-version:date:message-id:from:to :cc:subject:date:message-id:reply-to; bh=BdPbm+rkT3GHVS59MZEDgvgj7L9A5RUL+SzCGJWQgx0=; b=E2fVrNbhAQPet0pjUKIuy2ks84dUdjGPPGR04lqxV0rg1dFvAe6MLMQ4Tu4XX9JmVs q9L7vJKpIcCJvTznunzl5wyrvKrmQyUAvT2yLTMZXNlE68aedoEzwKZ46H1R3+73UbcY 2W1bmY8+qNzlucGQyCwfxBlqKMCcZDMVEb+3L/yK8iMJj6ckebigxx1wNbbcimtL2knM ASUqf8kRbqfBgOnfv8idYAV9CvqC9SLNRiFRgSpT+2wUiXrWD8f+yEYHt6kIi/etbmSA F7KkzFRR9Wv1gD+oSMaWga1615h9gfwkmxhUfXdeqDs/0XLx0ciChyMW14aDwROu6XPT PSRg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1721614436; x=1722219236; h=content-transfer-encoding:in-reply-to:content-language:references :cc:to:subject:from:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=BdPbm+rkT3GHVS59MZEDgvgj7L9A5RUL+SzCGJWQgx0=; b=LS8DcPxBARzqVpioSI5E5X+LNgeWZlTK0GD/rFEO4g3Jehl/SAdJHSSv5EbiKBWoDs HPXKyBTNhjpO5ejjsKo3Wt+rkUxwyKXyO6RR7fKch6YEyn4zvSAsSlneMSwvFyvfhjex oh0in4hl5i0OtmHxSwy8+xGpe8H1WBnWIu3mIwYF0eI7PyScaXx2gt1nTOK7YsKnNsec amZfjZZM/tmlILWlwLLWfbhQcqbRT2M3W0HDP7Kal0KI6S+tsPJ5H1SgoIjTp9JXhxhp PE+lWNgvKUicHilWWLHXvquSRmBNKBaizB2xg9MdTwDJTaaE/uVRJkGtV89KoC4pty1P IE5w== X-Forwarded-Encrypted: i=1; AJvYcCV4CL6VtIJgnJXT+eIAQ2Dn4HfcmEeS5kiH78Q8QrxJ/OMqVB/r+wazEUxj4E0vqPM5UfIJx2uCmbjSDhQndzWqRaf0M96n0nhSKXkn0t8NlwH4 X-Gm-Message-State: AOJu0YxeehRel6clvRUt8STXsvG2qIMIX09kuakoNjHPZLh07Lt4LHFE /GgOY72PX4E5uXm++kdUMbf+NuBG04gm2cOZ+6h17m2e4su6+ey5 X-Google-Smtp-Source: AGHT+IFX3W25moNkIMyrxDMxZXDZICp2Ae8FVd0wGSq61ZQcoWVm2lIegSrXFM8Nkw+7x2pSvD2xKg== X-Received: by 2002:a05:6a20:4306:b0:1c0:e629:3926 with SMTP id adf61e73a8af0-1c428568246mr4291995637.16.1721614435580; Sun, 21 Jul 2024 19:13:55 -0700 (PDT) Received: from [192.168.1.40] (cm-27-145-170-29.revip12.asianet.co.th. [27.145.170.29]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-1fd6f29409esm42915785ad.101.2024.07.21.19.13.52 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sun, 21 Jul 2024 19:13:54 -0700 (PDT) Message-ID: <66a0093d-1ccb-4ab8-9675-6a5e69aa9783@gmail.com> Date: Mon, 22 Jul 2024 09:13:49 +0700 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird From: Andrei Lepikhov Subject: Re: Removing unneeded self joins To: Alexander Korotkov , Dean Rasheed Cc: Tom Lane , Robert Haas , Richard Guo , Alexander Lakhin , "Gregory Stark (as CFM)" , =?UTF-8?Q?Micha=C5=82_K=C5=82eczek?= , PostgreSQL Hackers References: <64486b0b-0404-e39e-322d-0801154901f3@postgrespro.ru> <0ed2cf02-e655-6ec7-a4fe-52fd8d572f65@gmail.com> <735b5cd4-568d-fbf7-ad8c-dcfb4c3af86e@gmail.com> <2422119.1714691974@sss.pgh.pa.us> <24e93efd-eeac-43a6-a75a-ad68eacb32ee@postgrespro.ru> <3622801.1715010885@sss.pgh.pa.us> Content-Language: en-US In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On 20/7/2024 18:38, Alexander Korotkov wrote: > On Fri, Jul 19, 2024 at 11:30 AM Dean Rasheed wrote: >> On Wed, 17 Jul 2024 at 01:45, Alexander Korotkov wrote: > We initially didn't use ChangeVarNodes() in SJE at all. See the last > patch version without it [1]. We're trying to address Tom Lane's > proposal to re-use more of existing tree-manipulation infrastructure > [2]. I agree with you that the case with ChangeVarNodes() looks > questionable. Do you have other ideas how we can re-use some more of > existing tree-manipulation infrastructure in SJE? As I can see, ChangeVarNodes is dedicated to working with the query tree before the planning phase. SJE works right in the middle of the planning process. So, it may be more practical to keep it separate as a walker, as Dean has proposed. If the optimisation stuff changes, the walker code will be changed, too. -- regards, Andrei Lepikhov