Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.92) (envelope-from ) id 1jFZWx-0007m9-6s for pgsql-admin@arkaria.postgresql.org; Sat, 21 Mar 2020 08:30:55 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1jFZWv-0002xi-O4 for pgsql-admin@arkaria.postgresql.org; Sat, 21 Mar 2020 08:30:53 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1jFZWv-0002xb-Aj for pgsql-admin@lists.postgresql.org; Sat, 21 Mar 2020 08:30:53 +0000 Received: from excelsior.roeckx.be ([2a05:7300:0:100::3]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1jFZWs-0002DE-OG for pgsql-admin@lists.postgresql.org; Sat, 21 Mar 2020 08:30:52 +0000 Received: from intrepid.roeckx.be (localhost [127.0.0.1]) by excelsior.roeckx.be (Postfix) with ESMTP id 0F6ACA8A03B0; Sat, 21 Mar 2020 08:30:46 +0000 (UTC) Received: by intrepid.roeckx.be (Postfix, from userid 1000) id 634281FE0CCA; Sat, 21 Mar 2020 09:30:45 +0100 (CET) Date: Sat, 21 Mar 2020 09:30:44 +0100 From: Kurt Roeckx To: Rui DeSousa Cc: pgsql-admin@lists.postgresql.org Subject: Re: Append only tables Message-ID: <20200321083044.GI22330@roeckx.be> References: <20200320215053.GH22330@roeckx.be> <7CBBAB2A-A8C4-47D6-9912-7B3AD6554EAF@crazybean.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <7CBBAB2A-A8C4-47D6-9912-7B3AD6554EAF@crazybean.net> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk On Sat, Mar 21, 2020 at 01:44:47AM -0400, Rui DeSousa wrote: > > > > On Mar 20, 2020, at 5:50 PM, Kurt Roeckx wrote: > > > > Hi, > > > > I have a few tables that are append only. Thre are only gets insert > > and select queries, never update or delete. > > > > What I see is that every file is still being updated. It's > > currently about 500 GB big, and every of that almost 500 files has > > been touched the past 24 hours. > > > > (auto) vacuum is not happening on the table. > > > > Vacuum is still required as the tuples need to be frozen. Have you vacuumed the table? I did not manually vacuum them, nor did auto vacuum ever get triggered, at least not according to what is in pg_stat_user_tables; > It could be the result of records being frozen during selects statements; select can freeze tuples that meet the criteria for being frozen. I guess it's doing that now. iotop shows: TID PRIO USER DISK READ> DISK WRITE SWAPIN IO COMMAND 10227 be/4 postgres 67.68 G 67.56 G 0.00 % 79.66 % postgres: 12/main: kurt certs [local] VACUUM > I would recommend vacuuming the table to get the existing records frozen; then I believe you should see fewer updates to the all the base files. If this is needed, why doesn't autovacuum do this for me? Or do I need to modify some parameters so that autovacuum does get triggered? I actually didn't run any select query on that table yet, it's still importing the data. Can an insert also trigger the freeze? Anyway, the vacuum is running, I will let you know if it helps or not. Kurt