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 1s6Vow-0002jl-No for pgsql-general@arkaria.postgresql.org; Mon, 13 May 2024 13:34:28 +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 1s6Vow-001P1b-93 for pgsql-general@arkaria.postgresql.org; Mon, 13 May 2024 13:34:26 +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 1s6Vov-001P1T-UK for pgsql-general@lists.postgresql.org; Mon, 13 May 2024 13:34:26 +0000 Received: from mail-lj1-x231.google.com ([2a00:1450:4864:20::231]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.94.2) (envelope-from ) id 1s6Voq-0000KB-L0 for pgsql-general@lists.postgresql.org; Mon, 13 May 2024 13:34:21 +0000 Received: by mail-lj1-x231.google.com with SMTP id 38308e7fff4ca-2e576057c56so22555801fa.3 for ; Mon, 13 May 2024 06:34:20 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1715607257; x=1716212057; 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=0pDQzzWI41mYURuApAcxiVW1GsLTPmPq5g7miVjX9+8=; b=Sp1pEN5cmPi3yit+y/jvBdMIhA3RfUhBWl7Fy4CpYjN6tUaU/VgUwThJtGqs2NUzcf fevfuA615jCen1nRmt48WYYkWPFd1aZF45UImiQrhY5DbkJNwvHgKLHL31n51d7wbou/ bevcBje+Oe/Lh8LOZTJPZPzmUfqmPAcAT/ygjoFjS0czt4nEqi3b9CiHmo+s58xPH06g SwKIPN4bt9l9lO0kSA3km6kOpE0Oz96jSBocd+WejJXr8asHdjd7tlgk1MK/DJfi2N/K u8iJPEX8HM6jVtSP21AkCL3Vd22CohTj//3AGfrzPYq1wqsM6IJZnwJa3DNiBIYgD5gN 73TA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1715607257; x=1716212057; 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=0pDQzzWI41mYURuApAcxiVW1GsLTPmPq5g7miVjX9+8=; b=h6tcfAnIzHGhkaOgzbHXPWQNRGFqvMpJ3n3Lck/jZVFL23YAI+hHCAE36uBEq0QKRl /HEuMPWEeCakSUKICkolxuu+a0Xvn/0a38tWh9l0ZKBKIYbQYX+tAF6bcudEsfxfKhhg ll3C2bsyk2PDGYGVtRn44xDHVTk3x7Mmv6EGpOGiMdAYlQSRdFFh/FNrQssrE/vHAT+h uATlWLhkpv0nGyb2tVOCpyAFJKY5VKorAgsHiWhg/gUPr/Oci4PqxWk5wliMhO3EUHgP hLo0cAml8QWzItlum6TMEDtjR9GcA8rBKTujN8iuE3aMrBkWaT1lPrKYPOTTJk+5hRf+ gQhg== X-Forwarded-Encrypted: i=1; AJvYcCWT5R0ajqxwYLaKJIMgjrd+5FoSVz0j/WwcbmxjyG9VsUJbwgDJdXixYilYjGKD3o1TmDbi/abBDYSQINUDDcglGLcECqTJyQNu83exA37uQ0SE X-Gm-Message-State: AOJu0Yy9Mfme/RkpU16fsFpn60LZwHojhq/7B8k20vxNXxyq/MUD2w71 CSf6s1UIFUCMaejOPvrVobTidVKkqb9E8qotLK8Fa9COW4cnBVcWoHnsK3zkn62CG1KqY7kKOco 9oP+7SdrZ+93Xwbnytdt1jgq0WP0= X-Google-Smtp-Source: AGHT+IG7TKAmcHWaLwGn9YsZBhqWqBTfoWz4qbnFNmv+6rS3Y08w8hAIdht592OAhpJziBpOwX8KZHI+SuQvUdsboxQ= X-Received: by 2002:a2e:b385:0:b0:2e1:a15b:b504 with SMTP id 38308e7fff4ca-2e52028b19dmr60480651fa.37.1715607257282; Mon, 13 May 2024 06:34:17 -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> <3efce60b-48c0-160d-0444-474b02f76739@gmx.net> <8c923989-7944-d139-5ade-3d9f2588a11d@gmx.net> In-Reply-To: <8c923989-7944-d139-5ade-3d9f2588a11d@gmx.net> From: David Rowley Date: Tue, 14 May 2024 01:34:05 +1200 Message-ID: Subject: Re: SELECT DISTINCT chooses parallel seqscan instead of indexscan on huge table with 1000 partitions To: Dimitrios Apostolou Cc: Tom Lane , 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 Tue, 14 May 2024 at 00:46, Dimitrios Apostolou wrote: > > On Mon, 13 May 2024, Dimitrios Apostolou wrote: > > > On Sat, 11 May 2024, David Rowley wrote: > >> If you look at [1], it says "Tuples changed in partitions and > >> inheritance children do not trigger analyze on the parent table." > > > Do I read that correctly, that I have to setup cron jobs to manually > analyze partitioned tables? It means that auto-analyze won't touch it. Periodically doing an ANALYZE on the partitioned table is probably a good idea. David