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 1thuYX-008PWN-S5 for pgsql-hackers@arkaria.postgresql.org; Tue, 11 Feb 2025 18:00:22 +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 1thuYW-00Djph-J1 for pgsql-hackers@arkaria.postgresql.org; Tue, 11 Feb 2025 18:00:20 +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 1thuYW-00DjpZ-4d for pgsql-hackers@lists.postgresql.org; Tue, 11 Feb 2025 18:00:20 +0000 Received: from mail-pl1-x630.google.com ([2607:f8b0:4864:20::630]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.96) (envelope-from ) id 1thuYU-000GL7-0I for pgsql-hackers@lists.postgresql.org; Tue, 11 Feb 2025 18:00:19 +0000 Received: by mail-pl1-x630.google.com with SMTP id d9443c01a7336-21f78b1fb7dso48242635ad.3 for ; Tue, 11 Feb 2025 10:00:17 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=j-davis-com.20230601.gappssmtp.com; s=20230601; t=1739296817; x=1739901617; darn=lists.postgresql.org; h=mime-version:user-agent:content-transfer-encoding:references :in-reply-to:date:cc:to:from:subject:message-id:from:to:cc:subject :date:message-id:reply-to; bh=zu79jfu6Vvq5QoURGuBW+RSjCTZryy5uIi3ugENLFmQ=; b=i7S4L0KD5/yNHTtkcacPUeKp6KXcC5nbCh+ppfRuvsWskrdTaCSPNYCgeikZuMNbQ7 pdyrH+MpTiBgMvHpYnwn1sQKusKVbTmwiuKTgs0nsALbhgyAlnYYoHcmf/tfYD/YnpbZ 0EFiTArEFMtpdWlg2gdBQ2R4a8nbMOCmBTLimrLeTdh0Ff40iBC02h7nxrr7YvL4EYHH xywvyOpTotFatTMB9PNrpOO2nkhAD0BXYPpfsh1uhYgMmetPI7dDTxCCMTD9C33Vb6x1 Xn5nkGL7n6PyEstV+75mShocaITYZfVp5OX0YMPzAYFfruvJO1F1dM6JvmCUwdVhs+9g sfVw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1739296817; x=1739901617; h=mime-version:user-agent:content-transfer-encoding:references :in-reply-to:date:cc:to:from:subject:message-id:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=zu79jfu6Vvq5QoURGuBW+RSjCTZryy5uIi3ugENLFmQ=; b=M3XUWSY1ttPMQiw7K6FlHQaBMtP31xADqugIYQNdSrWC7nIgEOB1sOvv6Y9j0C4kJn iEAjTR0EK/eNhJcgR4HxRgKo2eXWeWIMYmF6zrpuoDzuOy3OTcRj/P9kDP1jEF/lkxW+ DDvqVh2UDgW4BQHT24hS3r58jM3r2r95BcvT1lIEYqzLCHVR9ZOfjOvFzZlMGpL88Qvr eAyD5Xj+AW1iFSLH6fGR08N+J7grpYn5UibU16hUvoajyPw7VmycfAuYxfiMRjCogvEB m9tfR6AWD6i1J8plvoZXvtVcia88pnyJlzMqll+sMxKCDQJD3ftAQ+zMuKOHQWAeXoJ2 ihnw== X-Gm-Message-State: AOJu0Yz0A8KdeYpqhnRQhSvR8JTwaCxzv9GHvSRIlQ36pIPH07fBt8NO wsLNlwgvjt4jTJrvviqoEs26WEPIGQBdqJoICM5ZocPP/dvXhvMPnA/FpPijDw== X-Gm-Gg: ASbGnct/BrHhVwHkhpKn55HYyNZ6kUUizBo5/lVv60LKkwfFIlyaO56iMnozlI8fg+3 G8dyIrq1gR2lgVgoQovbTLT31yZUlAL+CYFXOIwsmeZ71Q1XnINLE0bjGnRDgYydkz/se6pB4Bz fH3fv24M59BsOxp6Hi95dRW/t2pot2nYUUwkpArtFpsrcA/Dwgl8UgljTvjs1pPZVnx2qaFPU76 fhn5PIuvhKQGW3flqt1K6Gv4SwBNBpuJ7IP2FWxJGDaZMjGuka3Tfp7pR9lmr/0Ykh/IUVaojEE 9rnZWaGNu8JOOf0= X-Google-Smtp-Source: AGHT+IGnYSYz+bEo3l9JGm8e6G0bNQusDKsvMlClOQYsi9UDZCaAuuErBoIo0+Trm2IJxMgCA606aw== X-Received: by 2002:a17:902:ec91:b0:21a:8300:b9d5 with SMTP id d9443c01a7336-220bbb08be5mr3131075ad.23.1739296816714; Tue, 11 Feb 2025 10:00:16 -0800 (PST) Received: from [172.18.5.11] ([12.126.244.130]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-21f3683d8f4sm98108105ad.116.2025.02.11.10.00.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 11 Feb 2025 10:00:16 -0800 (PST) Message-ID: Subject: Re: Proposal: "query_work_mem" GUC, to distribute working memory to the query's individual operators From: Jeff Davis To: James Hunter Cc: "pgsql-hackers@lists.postgresql.org" Date: Tue, 11 Feb 2025 10:00:14 -0800 In-Reply-To: References: <0beedccb92ba5a1db386bd09b44e15b20c1ac1fc.camel@j-davis.com> <6b134f12c727fdb3a03849deab585dea0dfb30aa.camel@j-davis.com> Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable User-Agent: Evolution 3.44.4-0ubuntu2 MIME-Version: 1.0 List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On Mon, 2025-02-10 at 19:09 -0800, James Hunter wrote: > I think it makes sense to split the work into two parts: one part > that > improves SQL execution, and a second part that improves the > optimizer, > to reflect the improvements to execution. I like the idea to store the value of work_mem in the path/plan/executor nodes, and use that at execution time rather than the GUC directly. IIUC, that would allow an extension to do what you want, right? A planner hook could just walk the tree and edit those values for individual nodes, and the executor would enforce them. Regards, Jeff Davis