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.96) (envelope-from ) id 1vWeUx-006eoC-2w for pgsql-general@arkaria.postgresql.org; Fri, 19 Dec 2025 17:42:40 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1vWeUw-008bzi-2i for pgsql-general@arkaria.postgresql.org; Fri, 19 Dec 2025 17:42:39 +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.96) (envelope-from ) id 1vWeUw-008bzZ-1Z for pgsql-general@lists.postgresql.org; Fri, 19 Dec 2025 17:42:39 +0000 Received: from mail-wm1-x329.google.com ([2a00:1450:4864:20::329]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.96) (envelope-from ) id 1vWeUu-001dWl-3B for pgsql-general@postgresql.org; Fri, 19 Dec 2025 17:42:38 +0000 Received: by mail-wm1-x329.google.com with SMTP id 5b1f17b1804b1-47798ded6fcso14334685e9.1 for ; Fri, 19 Dec 2025 09:42:36 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cybertec.at; s=google; t=1766166156; x=1766770956; darn=postgresql.org; h=mime-version:user-agent:content-transfer-encoding:references :in-reply-to:date:cc:to:from:subject:message-id:from:to:cc:subject :date:message-id:reply-to; bh=bDXsEcmkjAVoqg1yQW/gIhStcHOaX46aGJZW0XJ+DRo=; b=NZFe8nkCC82r974ubvWh8hx548WwvxrNW6oHYDJT+JREkeVStuWPb6w+1fu8HPtdYe 6RQQqfR80NurG2v1Gqc7ER8tFnsDz2pGW0HpbzbEsZlXq8tYYL2CuXzve9Jjb8/lpxFx mgQKsNHq4jmCgH45+jydOVx0Z3dFkKSVZTgu3wgEj6Gqy5kAjP9XcxSSinLqAOBCiL3N THdy/DHNOCdbMnwWXnK8Qr9Yfm6NNue5SRgQO/iRD7xW5cGy/Q0Yth8l1Ql+O59IafgO g8zvEp+GV+aKq6rsf1jUsb6y9YCoi7YQlm5AhQ71FunlH9oWS9Ok0N2rixC0TAcpMEUo M0FA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1766166156; x=1766770956; h=mime-version:user-agent:content-transfer-encoding:references :in-reply-to:date:cc:to:from:subject:message-id:x-gm-gg :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=bDXsEcmkjAVoqg1yQW/gIhStcHOaX46aGJZW0XJ+DRo=; b=K6CBb26US68ouGYtCqM6w2uUcqYcnf5xG0T7VGZqJK6qfirzywYweQqEj1soyH1Nif UOxY/Haog73Q/ZPAy9c/dNXl5EjjeAN7h0/htNmDmkA3rXf5oGZrc+wLyAVA4aWhshBN 2zNz5vLja4PI1r0VJOIuu+iSLyGXrGZv05zKR3cXjWlEG9EPOcdoDIwhAtrjb64xN+xn ds3UJf3JX1aiJaXLy2yR9M+P8oJp+01r7StEE8HOVAa+xZyWMRrAN8KrYunx0tUWCcfG Z+sr6JxxeIDciEZArxWkMcZRL/3iPwPFjS3yoP+8KroMQea7NC4agErW1GzQ7nthC3tD Vu5A== X-Gm-Message-State: AOJu0Yy0LHsd/HQ/yAlKbYxM/nGvPfDOt5YqC97U+07f6CmWeKB/fVIU 7OsOaTMyeZcGQdZ1pq0h/YMhX+PK9mp4snL5Khs8h+EG80aXA/ac39ZP+EzcLhX2ZPw= X-Gm-Gg: AY/fxX40sbyXZqRjXNk8SEgpsmxQY+tPJrID8ogVgznDbr+Mp/Gclu4tY+YPY5efllq HsDVywP0GcDVS3NUeU6104nnN4Vz1cwoggj9bFZVyGrTYTJERmAJPJhZhxZf5oSNAl4I5AaEN50 RnmnbaXrOpedwX5hsbIZt0jxsRatUh0mR4s7C8zwsFAMe6/FE5N1d+kdgpkSBwUAq+h0TWf4gt0 eeHQK1mfUBiY/fqjPSS8kaJMpBXNXDzUoW+aKyVMIzuxh/0HxjqyKhrzy30iMQZsOROsXMJD930 PRfIEtsIMgyFULFwxNKxlya8rZ4RSTlH3Hv/Gw0gzvnWxdOPVUX1Q73QMjEWaGLcgd8XO9FsThe hofkdtKJnh1YxcoWUfdueJYXoMKilVJgHjboJGWWl+P1ZAEHky/ObQURaTmYYzUT7Tmcy383j0H RNPKrUxg8GFtTPx0SIGPB/1lc0bOgyPKN1mDFG7kjqeDE= X-Google-Smtp-Source: AGHT+IEeFUoSyXpBgxn6yw/90hX5661WjVs6e2AKrPgCpjri71ZjfOMf11ZFJnaVinXyd2sPIl+0Sg== X-Received: by 2002:a05:600c:540e:b0:47a:7fd0:9f01 with SMTP id 5b1f17b1804b1-47d195522f7mr36773855e9.16.1766166155790; Fri, 19 Dec 2025 09:42:35 -0800 (PST) Received: from laurenz.albe-K4N0CV00F97414D ([2001:871:270:4cf9:1875:33eb:6694:f468]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-47be2723d19sm119981475e9.2.2025.12.19.09.42.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 19 Dec 2025 09:42:35 -0800 (PST) Message-ID: <64ccdcb7b15a17cbf610854e51cd8235c246cca8.camel@cybertec.at> Subject: Re: Dealing with SeqScans when Time-based Partitions Cut Over From: Laurenz Albe To: Greg Sabino Mullane , Matthew Planchard Cc: pgsql-general@postgresql.org Date: Fri, 19 Dec 2025 18:42:34 +0100 In-Reply-To: References: <87bjjv1v96.fsf@gmail.com> Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable User-Agent: Evolution 3.56.2 (3.56.2-2.fc42) MIME-Version: 1.0 List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On Fri, 2025-12-19 at 09:49 -0500, Greg Sabino Mullane wrote: > If this is still an issue after you check David's theory about premature = analyzing, > another approach is to pre-populate and pre-analyze future tables. Someth= ing like this: >=20 > * disable autovac on the future table > * detach the table from the main partition > * insert a few hundred thousand rows into it, then run analyze on it > * can pull rows from a current table, or just use random data on a key co= lumn- whatever is enough to generate "good" stats > * delete the rows - the stats will remain > * reattach the table > * enable autovac if you like; I would not I doubt that that is good advice. For one, wrong statistics are not necess= arily better than no statistics. Disabling autovacuum is dangerous - and re-enab= ling it would trigger another autovacuum, which would undo your efforts. *Not* re-enabling autovacuum is not an option, unless you schedule explicit VACUUM runs on the partition. Yours, Laurenz Albe