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 1stjOW-0019Pm-GO for pgsql-general@arkaria.postgresql.org; Thu, 26 Sep 2024 07:58:37 +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 1stjOV-004O0k-2s for pgsql-general@arkaria.postgresql.org; Thu, 26 Sep 2024 07:58:35 +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 1stjOU-004O0c-Mz for pgsql-general@lists.postgresql.org; Thu, 26 Sep 2024 07:58:34 +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 1stjOQ-0019rF-R5 for pgsql-general@postgresql.org; Thu, 26 Sep 2024 07:58:33 +0000 Received: by mail-lj1-x22e.google.com with SMTP id 38308e7fff4ca-2f75c56f16aso8794531fa.0 for ; Thu, 26 Sep 2024 00:58:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kleczek.org; s=google; t=1727337511; x=1727942311; darn=postgresql.org; h=to:date:message-id:subject:mime-version:content-transfer-encoding :from:from:to:cc:subject:date:message-id:reply-to; bh=+Xry++/P2AxzRDoIXwURcR4vFAcqhBtgEmmZfXbdR3Y=; b=AlmDL0THCGjcDL2rTyQmOrPnULC/Ov/hbAVP+csTYH/dRG3eXzckohNAUWfQIxgHDs DKinMtRBfCDb/B2oSJYf27CIYF+w9S0rlVQbE8Vqb+Wzk/od+SSUGm/n2/l5SOQdJnTt A6zzrcizD+OLsQz0q/isWscLDlvzt2Ci/u0VA= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1727337511; x=1727942311; h=to:date:message-id:subject:mime-version:content-transfer-encoding :from:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=+Xry++/P2AxzRDoIXwURcR4vFAcqhBtgEmmZfXbdR3Y=; b=fFHfAlgwnOLOFkkCaop3WoFjQqMnNYXfxqX6w1LNbsNeGrUFbx5rSmjN8Y4D1zHfnW SEV1pHH+Pyf07tRb+L3cTMdG+NF+69/hrZdY1EZ/hKJbuaU+Z8IzTcykY8xPL+5+0UTE Zv3r3u2mRSDJEhsiarMPJWlRYGydr1EAdFUygczsdSu1qzNkBv6x5mFo0zqzlIJSrsU5 8VPRxJZTIKrIxyeZoRi5QSlze2xzweVGXVZ9uY/U+ToLHHPfJHf3C0v4UYwoBbLQk1r0 WCjysOGHyI6ZbT/Xy6RvxTUvS+OOunX6EPtlglbnj7EFWlqmOAJqgBO7qiCMBV+eFZE7 9jPA== X-Gm-Message-State: AOJu0YzKZqRTSt5y4+BHJ+FpI/VYOu8DixSVHTKvk7AN+EMRLYkjcoiR mlWYqgf3zF9kZBGlI4hoy/L6bnyGMKHgo0s+XxbqxtvJW4vrvcLtFmg3BJixMO4brRMjZtv83ZC e X-Google-Smtp-Source: AGHT+IEoYX5cEM2uwD/Bl0NwL1JyWxmEx736DhE7bCtjo6DECr7MKJNgsOBH40pIXWbfLX7I7jNyuw== X-Received: by 2002:a05:651c:1547:b0:2f6:5f0a:9cfe with SMTP id 38308e7fff4ca-2f91ca6ee3emr27412921fa.30.1727337510756; Thu, 26 Sep 2024 00:58:30 -0700 (PDT) Received: from smtpclient.apple ([165.1.189.190]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-42e96a0d8eesm40355075e9.30.2024.09.26.00.58.29 for (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Thu, 26 Sep 2024 00:58:29 -0700 (PDT) From: =?utf-8?Q?Micha=C5=82_K=C5=82eczek?= Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: quoted-printable Mime-Version: 1.0 (Mac OS X Mail 16.0 \(3776.700.51\)) Subject: Partitionwise aggregate and runtime partition pruning Message-Id: Date: Thu, 26 Sep 2024 09:58:18 +0200 To: PG-General Mailing List X-Mailer: Apple Mail (2.3776.700.51) List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Hi All, I have a question about partition pruning. Does runtime partition pruning (ie. pruning performed during execution) = work with partition wise aggregates? 1) I have a setup with a mix of foreign (postgres_fdw) and local = partitions. 2) I want to perform an aggregate query and I want the aggregates to be = pushed down to remote servers. To make it possible I set enable_partitionwise_aggregate to on. My observation is that partition pruning works during planning time But with plan_cache_mode =3D force_generic_plan, explain analyse execute = prepared_stmt(params) shows that _all_ partitions are scanned (and queries sent to remote severs for all = remote partitions). When I set enable_hashagg to false runtime partition pruning works but = no pushdown is taking place. Am I missing something or runtime partition pruning is not going to work = for generic plans and partitionwise aggregates? Thanks, Michal