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 1thgef-005g6b-Vi for pgsql-hackers@arkaria.postgresql.org; Tue, 11 Feb 2025 03:09:45 +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 1thgeb-006ugk-L3 for pgsql-hackers@arkaria.postgresql.org; Tue, 11 Feb 2025 03:09:41 +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 1thgeb-006ugc-BU for pgsql-hackers@lists.postgresql.org; Tue, 11 Feb 2025 03:09:41 +0000 Received: from mail-ed1-x541.google.com ([2a00:1450:4864:20::541]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.96) (envelope-from ) id 1thgeZ-0008uF-0c for pgsql-hackers@lists.postgresql.org; Tue, 11 Feb 2025 03:09:39 +0000 Received: by mail-ed1-x541.google.com with SMTP id 4fb4d7f45d1cf-5de5bf41652so4814651a12.1 for ; Mon, 10 Feb 2025 19:09:39 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1739243377; x=1739848177; darn=lists.postgresql.org; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=wR9ra/V1mpYqQABEP0IKSdJhwnG9uY624QZ73ZW/pOg=; b=V/awyo/yFX0kqQmyBemWL8Amf7Qx2DzoWb9ypjLvrEyKo4nQ6eGcBfXMIZOeY06Rug WB4mb1CXiwMsPORGaF/Ycyh2SuXOA68Sad+ojijeSIfXbhVRCAyshwor1gtGLYxKzpVc ZpdcZa8lNbJKEArmpWvyBxtiqMKJVsq+tkkHHbpnMqvQvySSbjYB5Iz+W/1vk0/c+JLM Lf6iq0wOvF1It16K0CjgyZcaUiDYDBuldtAKvg2eUFoGNGcS7Jj8MIe9J6NnnHEAso61 JSef2bzVVAukRJV+1KxUi/oZozQ9oPUXG550LJiu9jYxON5xz1ABeswRm+Ji4mB04HKM jw2A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1739243377; x=1739848177; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=wR9ra/V1mpYqQABEP0IKSdJhwnG9uY624QZ73ZW/pOg=; b=OJ0JtNu+1NXrGsgVhtHLUiu1Q/YdrkwlbZl9Ui0LClNU8G1Azz2pAgx5CoaGQRt9xy 7qfTmyVvPIgq8JQi4bglPHjyXmSPOKaGZewaB+j8KDu26v3FyAohIa85gcfLrnHUkCcK ddjoWKgJP5KhMepTgqJsP+oEwgBfwZlUNTT0dlkUN6vog39Ovs9/kG70ZT+1N2UvFSsd 3RAfrR+GChs5SEi9TTSMxocjooSqkZyEd0pFUTE4/zZWzyY9Yuo2LQxegPXUsyZ+qqvI vSGFNyh0u+T4Q5oxCEEVb7Fh3VfGLvr3aiclf/1a1Jh0nQ6GDH8xvANqcMkE0k523WY8 ykwg== X-Gm-Message-State: AOJu0Yx71j0FORWAhWqd/Cz8LvDxMBM6yXLMNVCNGoj1x1evWgDE8v91 dx0AtwJOMrodyFqpOvDXj7RCk0sAvocyCNKyjzTiiHmdLktn3IXkK/XypBt8eRvt4EsJAQwSLka FTd3dcZAVmVXS8ZfFiChetAWg2W0= X-Gm-Gg: ASbGncspBqYXiifa6XYl1iJiNeOj+dYGhCngYrHsLu0twq2Ldh8ejYjrqyF4pYI2d4Q /9a/n+T7OWOG9HL6z0SbHIqHn4ek+JeZo+q5aIfJ7Q6SrY73ZiG/S9JtfYFw/BEXHVuBHa8RcXW 0= X-Google-Smtp-Source: AGHT+IHi5Fkf8RnAWJP7CGn5PsnVFsYY0/Noe/nBtNGKcqUQ/0wjHNSJt2hFkOtziDHE96z0yB9IesHnDm62GmRGmq4= X-Received: by 2002:a05:6402:1ec1:b0:5da:b47:1092 with SMTP id 4fb4d7f45d1cf-5de45004629mr16142005a12.10.1739243376811; Mon, 10 Feb 2025 19:09:36 -0800 (PST) MIME-Version: 1.0 References: <0beedccb92ba5a1db386bd09b44e15b20c1ac1fc.camel@j-davis.com> <6b134f12c727fdb3a03849deab585dea0dfb30aa.camel@j-davis.com> In-Reply-To: <6b134f12c727fdb3a03849deab585dea0dfb30aa.camel@j-davis.com> From: James Hunter Date: Mon, 10 Feb 2025 19:09:25 -0800 X-Gm-Features: AWEUYZmx1hYjg97c7h5jQgFj2Q2g5xw9shSGMCiqNNcaBBBhKnMfZYM2O1foLBg Message-ID: Subject: Re: Proposal: "query_work_mem" GUC, to distribute working memory to the query's individual operators To: Jeff Davis Cc: "pgsql-hackers@lists.postgresql.org" Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On Fri, Jan 24, 2025 at 5:48=E2=80=AFPM Jeff Davis wrot= e: > > On Fri, 2025-01-24 at 17:04 -0800, James Hunter wrote: > > Generating "high memory" vs. "low memory" paths would be tricky, > > because the definition of "high" vs. "low" depends on the entire path > > tree, not just on a single path node. So I think it would quickly > > lead > > to a state-space explosion, as you mention. > > At first, it appears to lead to an explosion, but there are a lot of > ways to prune early. ... > > Maybe my idea doesn't work out, but I think it's too early to dismiss > it. 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. It seems better to me to wait until we have the ability to enforce memory limits, before worrying about ways to generate different paths with different memory limits. Then we would be able to tune the optimizer heuristics based on the actual executor, instead of extrapolating how the executor would behave under different memory limits. James