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 1s5bg1-006ejq-EO for pgsql-general@arkaria.postgresql.org; Sat, 11 May 2024 01:37:29 +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 1s5bfy-002dzz-Nc for pgsql-general@arkaria.postgresql.org; Sat, 11 May 2024 01:37:27 +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 1s5bfy-002dzr-D7 for pgsql-general@lists.postgresql.org; Sat, 11 May 2024 01:37:26 +0000 Received: from mail-lf1-x12b.google.com ([2a00:1450:4864:20::12b]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.94.2) (envelope-from ) id 1s5bfw-000Q3B-D9 for pgsql-general@lists.postgresql.org; Sat, 11 May 2024 01:37:25 +0000 Received: by mail-lf1-x12b.google.com with SMTP id 2adb3069b0e04-522297f91bcso1118239e87.3 for ; Fri, 10 May 2024 18:37:24 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1715391442; x=1715996242; darn=lists.postgresql.org; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=B6Q6u0xagbwOpv8+NvM4AwBwMeNxccJf9OcTe3mBiZU=; b=N9TAIfNhq5Z5bF6ZCl+Y3tbDmE5zJ+vi+yKcJBKuRlXujDrQVRVOTpuUZF/Og0s8og XLn+C46yXM5nx789OEf3H18ZcBjW96/Aer/U9kRHSCAiYPrPYeaHN/ut4PUq9A/pxptQ +kmFtciyQ1kO/dFok3TLCEsr10ouJzyDuFWd7Pbc4oaoIY1okha6DpUgFTRsMnpNdNEg TCC3dUx1PfMmTCNmcyp5YafP8RWBexzVtrI37DtIOtqdhKXARl9N33ur5Jw3wm2C5dIO 3Z5AcUSqY0nTbPR7fQ0UdVE5+LLtPbACWZjlarDnYtrGWC2rU06queZnrkTeDhcKMvCf tPgg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1715391442; x=1715996242; h=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=B6Q6u0xagbwOpv8+NvM4AwBwMeNxccJf9OcTe3mBiZU=; b=v5wJZEcQLP8tSCWd2XrZYLwcyrCIT6e5412adMbjradqqWeHUl0IbvgedvH6+y/wT+ NH2snxjkSFRP1XcZACISsyJzJS2/mTFABIUffkdOtyC8y/0rk8FFbueUuc9a+CI1ozeZ Uec7qZOEqw318Oj7YPn9k9KbFjY77xGg9BVSIwfsoHW8bn/pUbnuPTS1+OOM3WEwsk9I A8RK9Y+uH1DBsCwTsozvQUmh7Jh/pT9B//RlA2vqk6ISAqY2D2AhjNdPkmGIRO8+xQG8 H5KRlHcnWOeYGcE/00d9d7U/yi7hpDfaZEgi2pqnUMSxo40ViVgbPMoARpuf4asrQzTO nCQw== X-Forwarded-Encrypted: i=1; AJvYcCViuZzKp7fUy0ngQJrdRw+RXRRyJwSFVlYDXLq07XqkxwsGyOR8hItWrPg9PgaW+LwoTu/WRO+9VzXvDc/6L8lqy/mp1IGRqbjNNYoIP+vm08f9 X-Gm-Message-State: AOJu0YyDgvX44lDvdq6o0/2Ugsax2AEgpnG4HEYi5vP8lfTmqXJKhFM2 vX61Ev33pYFG831rLlOYE8yBWoWnsmrzoihxstssU4VnWGb3ajbMZR7B57wkpoZst4sG8i0ArXE 2le/ydVqDon+Qbh7UbHtKSVTU0BM= X-Google-Smtp-Source: AGHT+IEGNM77hZ1ty6XByRNXb1KqyoWYB970cWRkNRDy5cn1ct1LcZjiThr6f1CCm7VLs13/yzeOhCEAlTXYfibjjuk= X-Received: by 2002:a05:6512:34cd:b0:51a:c207:12b with SMTP id 2adb3069b0e04-5220fd826d6mr2276886e87.37.1715391442270; Fri, 10 May 2024 18:37:22 -0700 (PDT) MIME-Version: 1.0 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> In-Reply-To: <1685688.1715391218@sss.pgh.pa.us> From: David Rowley Date: Sat, 11 May 2024 13:37:10 +1200 Message-ID: Subject: Re: SELECT DISTINCT chooses parallel seqscan instead of indexscan on huge table with 1000 partitions To: Tom Lane Cc: Dimitrios Apostolou , pgsql-general@lists.postgresql.org Content-Type: text/plain; charset="UTF-8" List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On Sat, 11 May 2024 at 13:33, Tom Lane wrote: > I do kind of wonder why it's producing both a hashagg and a Unique > step --- seems like it should do one or the other. It still needs to make the duplicate groups from parallel workers unique. David