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 1s6WKx-0005bS-Op for pgsql-general@arkaria.postgresql.org; Mon, 13 May 2024 14:07:33 +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 1s6WKw-000Iqq-7Z for pgsql-general@arkaria.postgresql.org; Mon, 13 May 2024 14:07:30 +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 1s6WKv-000Iqi-Sy for pgsql-general@lists.postgresql.org; Mon, 13 May 2024 14:07:29 +0000 Received: from mout.gmx.net ([212.227.15.18]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1s6WKn-00019m-T5 for pgsql-general@lists.postgresql.org; Mon, 13 May 2024 14:07:29 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmx.net; s=s31663417; t=1715609240; x=1716214040; i=jimis@gmx.net; bh=MEEM2KiT0Q1KdSRUL9x4ZszO5wOf3rGOuxhBiqqpEMQ=; h=X-UI-Sender-Class:Date:From:To:cc:Subject:In-Reply-To:Message-ID: References:MIME-Version:Content-Type:Content-Transfer-Encoding:cc: content-transfer-encoding:content-type:date:from:message-id: mime-version:reply-to:subject:to; b=Bc+tgLh5VIVRrOQ7L0QhkWxxSNMdI8gwlATh7+MykNxENhNQtjkI19x1fc/JYQt1 SkLFMIqsDhoNp5Z5rfsphjPVZ1rS5q3b3YcqPSRWnHG3Dy3IsUXd/VdjYNTI/8gwR 0oSAdT2RFgOMs0P7pve2dBDguScJvHdkP6eXiVhGIDWDjuQq1oa9P36aM5nfFD1p8 +iem5oGYnYa9wyipdEXf6f3OTfzQS7CgF+BvBvlXvjyfCC2ZCg8T12bD4xBY3MHiF AbPeaBhSN0piKLbz2qGQXQEIDjXCNkGeTdYbOiY8roLh5imzDfaEoNh8SUMPlnZCS sRZn2xmTvs/hXKSlIQ== X-UI-Sender-Class: 724b4f7f-cbec-4199-ad4e-598c01a50d3a Received: from [10.9.70.35] ([185.55.106.54]) by mail.gmx.net (mrgmx005 [212.227.17.190]) with ESMTPSA (Nemesis) id 1N2mFi-1saRj21n92-0139rH; Mon, 13 May 2024 16:07:20 +0200 Date: Mon, 13 May 2024 16:07:19 +0200 (CEST) From: Dimitrios Apostolou To: David Rowley cc: Tom Lane , pgsql-general@lists.postgresql.org Subject: Re: SELECT DISTINCT chooses parallel seqscan instead of indexscan on huge table with 1000 partitions In-Reply-To: Message-ID: <410018fd-1f9b-41b7-6257-89844b984564@gmx.net> References: <7886a68f-b466-2131-1747-f69f0fb71a37@gmx.net> <69077f15-4125-2d63-733f-21ce6eac4f01@gmx.net> <559b0e40-63e6-fa9a-6b03-d1eba10f30f8@gmx.net> <1629463.1715372568@sss.pgh.pa.us> <6a2f3906-3d7a-6924-7403-8f77d57a18e4@gmx.net> <1685688.1715391218@sss.pgh.pa.us> <2e3947bd-b01c-37c8-00e1-d8e925e79597@gmx.net> MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII; format=flowed X-Provags-ID: V03:K1:PBSwA3ntp0Z7JOlAdnP9cDQAHNEL4g0TzPey+JQnPwcL7qeY9vW av3Tyvrzv+NGRj3Sd48BGJTBwsRGnRDragY/818Y1icnw81YtfQgrQKZGXlio0SDhj4PRyb yz5TVm7WNnKHIhuOQsravpmBaQXdyJtiPI/mjwY/lAMrwmpo33zaL11VmeRLA6YWS4wK4XU B7AQdbQEr7DWljzAxdq6A== X-Spam-Flag: NO UI-OutboundReport: notjunk:1;M01:P0:U3BkQoVIE1I=;IzlY97Omew2oYtEhtEsrOqH4Jnj Pj1cyrEZdFxJghzS6/GZW16DT0Mofm5SlL4btKTEOtLL9mIqCLXIAXvUNv1OtHurkfizNNpl2 XC0OqR/B/TKrcOYxZZEdIJT1dkkpfoG1RUTOVpIonQMXCXtfB88Pib48yRM/PwLCZfivkV6rE WfjTRP/TQTeSL+wJXQYDJ5Ba+51yvlILO0of/9vh89J5aiZHkhNWkjd9Xg2Tp0RIBOQ7/m1b0 sgM2Vh8swCQkQLPyK6AXvoU3Eq7zIk4zjLmSWJQ6mJQfruwc4NRuJiPqS3eVhz1GMCVwoiZJs KqC2+LMPx+wR7Ayegjs4Bw5sGwcd6xstbRPwAmNnoihoBvV5LQzwMuCHIDIkeGHzVjkOt/Pu5 8OPTorg5/5hgfr1Ym3l6W3+AhdiJP4VD4wwRInD2WoFGc/neeSgxs71KATnPofl8k0QfH1p1h Z3i52SrqS1Vu1JZNQ/NxRsQFHqnPDQQAwvvVC0Cx+hljfBiR2het7hSsl1z1rvrCQ1blvofUe i2rc4n7LATZs1xbxnOB51Ow3GBVdCBWtTNASZQZsE9OksG3mq5bjm7vsAEiXl0t752qTKCzrQ KSgTzK19915h447+uT7TvZxGT79SQEewWPI4ibcTnBEjg7d7z8hOMaHzQAEm+N2e33jQiqBvh w8UYGtLChOK/eqoBt+d6pMCSPSyLndEveyAUhwfcgDOQ6Xfjo5cv+pxWaNOzgQn4w9jmLhZAm PQofszDRhz6eJa8UpuLYEjKY5eA9foA4dnwgzKsQMA7r8jkpIcZEHegUcrrYKzw4WieSUxKfa ZbRuxpI6p4V3o3B0QWbSfNhAf0vK+o+29YvcXIZ9da3Uw= Content-Transfer-Encoding: quoted-printable List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On Tue, 14 May 2024, David Rowley wrote: > That assumes the Append won't ever use > 1 worker per subnode, but > that's not the case for your plan as the subnodes are "Parallel". > That means all the workers could be working on the same subnode which > could result in one group being split between 2 or more workers. Didn't think of that, makes sense! > Parallel Append can also run in a way that the Append child nodes will > only get 1 worker each. How can I tell which case it is, from the EXPLAIN output (for example the output at [1]) ? [1] https://www.postgresql.org/message-id/69077f15-4125-2d63-733f-21ce6eac= 4f01%40gmx.net Dimitris