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 1srZHL-002oma-8P for pgsql-bugs@arkaria.postgresql.org; Fri, 20 Sep 2024 08:46:15 +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 1srZHI-001Jwt-5S for pgsql-bugs@arkaria.postgresql.org; Fri, 20 Sep 2024 08:46:13 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1srZHH-001Jv6-Rg for pgsql-bugs@lists.postgresql.org; Fri, 20 Sep 2024 08:46:13 +0000 Received: from mail-wm1-x335.google.com ([2a00:1450:4864:20::335]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.94.2) (envelope-from ) id 1srZHE-00090h-LS for pgsql-bugs@lists.postgresql.org; Fri, 20 Sep 2024 08:46:11 +0000 Received: by mail-wm1-x335.google.com with SMTP id 5b1f17b1804b1-42cafda818aso16095935e9.2 for ; Fri, 20 Sep 2024 01:46:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1726821966; x=1727426766; darn=lists.postgresql.org; h=content-transfer-encoding:in-reply-to:from:content-language :references:cc:to:subject:user-agent:mime-version:date:message-id :from:to:cc:subject:date:message-id:reply-to; bh=mwr0+ORCOutVDKdZoHYEBxkdexjgnBAX34Hf+2PQB4E=; b=eXiKsdQnZQ6DBa/P8jgvaorjW59IfU7oW8hXlm4i6f4jB9K1yDjBHQBJ+Or3rzgUiF tGHPj0Um8y1H9j5XI+236wfL85eIL3xDtvB58PphcVaxPcJeZ4LlUHAHdcN397CSnq0k PXc7rgnhs1pSS00IXtrVyTfve9LwrkzNPh4AL+E8bLv57ciTdEt++S1UYZL2C5hRcsGI otVf1zsrm/nTNJEv/cEvPMv5QhZ0UDkGTE0cmQVYNx+qo5aMN8newsUzkQ2Eod2kvPT3 cQQPSR0L+yVKulEnKD8npaz/OsBmZ3Qe2D/gVMRdNrjMQPo6PAz7CR5Zz44GqTDz4s7z /UWw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1726821966; x=1727426766; h=content-transfer-encoding:in-reply-to:from:content-language :references:cc:to:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=mwr0+ORCOutVDKdZoHYEBxkdexjgnBAX34Hf+2PQB4E=; b=SUp1FW/Qi9FHUysJQNaasoW5ix7nMtSOHiKdTO5uiYzeHetGzultqj24Nt9VaLHegq 0SNzLNzys5URnPNxWzLnMyiHQ2SOrpEvPM+22AQXPUOj8sGTRtPwAJ1FBTlQfLES4T9k 52zMp28ZTCsaSPtXTAHB4zE50qfmM7HH6cYAD7p9UQyC3gpUcQGe4j6AJS4TazvLsSUL nAu4KDwfp/PtwpmEhjqjFblhNvbhEGoF34V7EpvXUDmxDqOQ4OD2mHZDoiMooNj4jcQd dUYGO/cTA3aT7hqak3ywA9pDXXgPhNZ2EQaIuDoIzpEwjHq5xcE5LkCAXRDCwx8ReA7X /d2w== X-Gm-Message-State: AOJu0YxqrLVjCNwTvEu8elGuqzJxFceXQecheijDQVf5z319p4Y6A8Ma bYM/pUzGvx8gVyIha0qrbbr3uUMCB1LpPfEIGSX4iiUU/i+zx73i X-Google-Smtp-Source: AGHT+IHMkFOvYuxvKIVK/KmjBl7afWeVrc4oP+oSGbMXMEiBZabMg2PR01YGn05r3WaYmKpO6onmng== X-Received: by 2002:a05:600c:3486:b0:42d:8340:cd13 with SMTP id 5b1f17b1804b1-42e7c1599ffmr13247435e9.2.1726821965653; Fri, 20 Sep 2024 01:46:05 -0700 (PDT) Received: from [192.168.18.235] ([45.93.57.193]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-42e75450114sm42998785e9.23.2024.09.20.01.46.04 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 20 Sep 2024 01:46:04 -0700 (PDT) Message-ID: <6828898d-5fe1-4709-816e-5cf606974227@gmail.com> Date: Fri, 20 Sep 2024 10:46:03 +0200 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: Volatile functions under Memoize node To: David Rowley Cc: PostgreSQL mailing lists , Richard Guo References: <7ab4aac3-4790-416f-98b8-2ec0707cceb5@gmail.com> Content-Language: en-US From: Andrei Lepikhov 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 On 20/9/2024 04:36, David Rowley wrote: > On Fri, 20 Sept 2024 at 04:47, Andrei Lepikhov wrote: > I'm not sure if it's a good idea to penalise your case when we're not > all that consistent to start with. Is this causing some sort of > breakage? I skimmed the code entries with such checks and found out that the initial reason was to avoid index scans, with a reason that such a routine should be applied to each tuple of the table. The second reason - to postpone expression evaluation (9118d03) - is also reasonable for me. It was introduced to be consistent with the clause's syntactical level in the SQL. It seems to follow the same idea as disabling subquery pull-ups: to avoid multiple evaluations and change the syntactical level. At the same time, Material doesn't care about volatility. So, what was the idea behind the commit 990c365 you added? -- regards, Andrei Lepikhov