Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1ophwa-0002Ne-9b for pgsql-general@arkaria.postgresql.org; Tue, 01 Nov 2022 03:28:04 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1ophwZ-0000el-22 for pgsql-general@arkaria.postgresql.org; Tue, 01 Nov 2022 03:28:03 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1ophwY-0000eF-L6 for pgsql-general@lists.postgresql.org; Tue, 01 Nov 2022 03:28:02 +0000 Received: from mail-oi1-x233.google.com ([2607:f8b0:4864:20::233]) by magus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1ophwW-0007qS-AJ for pgsql-general@lists.postgresql.org; Tue, 01 Nov 2022 03:28:02 +0000 Received: by mail-oi1-x233.google.com with SMTP id b124so2262937oia.4 for ; Mon, 31 Oct 2022 20:27:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=in-reply-to:from:references:to:content-language:subject:user-agent :mime-version:date:message-id:from:to:cc:subject:date:message-id :reply-to; bh=l9+UxqA3aWQyAZSDq6mPL8MaBzfN+P8k1Z3osInDKXk=; b=BJsQobwyAI/UXVTXxMYfUl8xCLYcQuZ5FviVieUh7zPN6/8CA2LsvqKT+HQwORTDcn ViqC8dYfo5K+milkkUX0pRk/JigMFoBEInRukuEzMmtboUED41lwsWAk5C2ucrGud0fO rZF+Vv9E4QUq6idKmza6HF501dfUnzvsUFSe4VUZtVs0gQzQjPfqHs9f9lF/NJ1ibj6h cbjrXZCkmM9KX331EQz1zQrjaVkeer+YpjX/Kg4Onv0HRNSwrghHvV0f7692znyxuQMg 5tIc0iZKnTKpwSDt1l6qYtEtJNLtroSIFUImCId6Uclvw76uNJpOsVtaPsONGAhsCrkO 0L1A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=in-reply-to:from:references:to:content-language:subject:user-agent :mime-version:date:message-id:x-gm-message-state:from:to:cc:subject :date:message-id:reply-to; bh=l9+UxqA3aWQyAZSDq6mPL8MaBzfN+P8k1Z3osInDKXk=; b=BZGHjD519kV8FqWwEputDEYxM6F0BkNfWfJQfWlnFU1XFON0XPyhUtLdD8z49go3/7 YJT0UqyUNYK5+UHHnQkhR0tyNsqZOs5QrP+msgeqYXMY1J+JrbZppFELGS3tCwDYzWOS IdPWvHPecYtNSAWLSnhoNgr0pCu0p9s+fjo0HL8inoxAOMEcsjaxJr6Gt5ve3QlDdUFS O0pPhW+OxIyblTfhbU3jSZdCi7JH0eiufcBYFbuDPfZwpteWRqXKoZHKTMSv1FbO3Xwm mIbKktwmos3EbeW5fJuxh6XihxrhIGZ1qhD20UhCYkdJeRjbc8lGUXxZCqTAavEc60TA YrRw== X-Gm-Message-State: ACrzQf26JKkOofumX6Xm7deMx/8U13Dh+XbLHUAhEFRbhSKePol6WjVq MmSh062lZUstWp1svDkjP1UunqFOFsI= X-Google-Smtp-Source: AMsMyM5fW2paD1V3KhQK+dH8XFdqv3JCy3DIRaExZppn8+95sondY+w8gIatEx7IP8ZKMmChVTgPdQ== X-Received: by 2002:a05:6808:254:b0:359:f10b:5469 with SMTP id m20-20020a056808025400b00359f10b5469mr6887222oie.248.1667273277791; Mon, 31 Oct 2022 20:27:57 -0700 (PDT) Received: from [192.168.88.10] (ip68-11-68-85.no.no.cox.net. [68.11.68.85]) by smtp.googlemail.com with ESMTPSA id n17-20020a05680803b100b00354978180d8sm2992919oie.22.2022.10.31.20.27.56 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 31 Oct 2022 20:27:57 -0700 (PDT) Content-Type: multipart/alternative; boundary="------------qg6f6qGO10OI0KVfAsS0dNCL" Message-ID: Date: Mon, 31 Oct 2022 22:27:56 -0500 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.2.2 Subject: Re: Autovacuum on Partitioned Tables Content-Language: en-US To: pgsql-general@lists.postgresql.org References: From: Ron In-Reply-To: List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk This is a multi-part message in MIME format. --------------qg6f6qGO10OI0KVfAsS0dNCL Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit On 10/31/22 17:26, Ryan Ruenroeng wrote: > Hello there! > > There is a statement in the Postgres Docs: "Partitioned tables are not > processed by autovacuum." > > What does the above statement mean? > Does autovacuum not process both the parent and the child tables in a > partition relationship? Partitioned (aka parent) tables are "virtual".  There's nothing to vacuum are analyze. > > What is the definition of a partitioned table? > > I have a table with 50+ million rows that gets data added to/wiped from it > every 90 days. We are planning to break this table into a few thousand > partitions. 1. That's a lot of partitions.  Older (like v12) query optimizers don't do a great job handle that many partitions. 2. Be careful what you partition on.  (We added "partition_date" to PKs so as to partition by date, even though the "real" PK is a synthetic key; it was a query performance *disaster* in Pg 12.) > More partitions will likely be added in the future, but we don't have > plans to delete any of the partitions. Will we need to manually track the > statistics of these partitions and manually vacuum the tables or will > autovacuum help to manage them? Autovacuum will handle it. -- Angular momentum makes the world go 'round. --------------qg6f6qGO10OI0KVfAsS0dNCL Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: 8bit On 10/31/22 17:26, Ryan Ruenroeng wrote:
Hello there!

There is a statement in the Postgres Docs: "Partitioned tables are not processed by autovacuum."

What does the above statement mean?
Does autovacuum not process both the parent and the child tables in a partition relationship?

Partitioned (aka parent) tables are "virtual".  There's nothing to vacuum are analyze.


What is the definition of a partitioned table?

I have a table with 50+ million rows that gets data added to/wiped from it every 90 days. We are planning to break this table into a few thousand partitions.

1. That's a lot of partitions.  Older (like v12) query optimizers don't do a great job handle that many partitions.
2. Be careful what you partition on.  (We added "partition_date" to PKs so as to partition by date, even though the "real" PK is a synthetic key; it was a query performance disaster in Pg 12.)

More partitions will likely be added in the future, but we don't have plans to delete any of the partitions. Will we need to manually track the statistics of these partitions and manually vacuum the tables or will autovacuum help to manage them?

Autovacuum will handle it.

--
Angular momentum makes the world go 'round.
--------------qg6f6qGO10OI0KVfAsS0dNCL--