Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1gJHGr-0001Tw-2A for pgsql-admin@arkaria.postgresql.org; Sun, 04 Nov 2018 12:12:49 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1gJHGo-0008W0-7b for pgsql-admin@arkaria.postgresql.org; Sun, 04 Nov 2018 12:12:46 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1gJHGo-0008Vt-06 for pgsql-admin@lists.postgresql.org; Sun, 04 Nov 2018 12:12:46 +0000 Received: from lungold.riddles.org.uk ([82.68.208.19]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1gJHGm-0006il-5P for pgsql-admin@lists.postgresql.org; Sun, 04 Nov 2018 12:12:45 +0000 Received: from [192.168.127.1] (port=61330 helo=caithnard.riddles.org.uk) by lungold.riddles.org.uk with esmtps (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.88 (FreeBSD)) (envelope-from ) id 1gJHGk-000Nb8-Aj; Sun, 04 Nov 2018 12:12:42 +0000 Received: from [127.0.0.1] (port=39475 helo=caithnard.riddles.org.uk) by caithnard.riddles.org.uk with esmtp (Exim 4.89 (FreeBSD)) (envelope-from ) id 1gJHGj-0003aI-Kz; Sun, 04 Nov 2018 12:12:41 +0000 From: Andrew Gierth To: Mariel Cherkassky Cc: pgsql-admin@lists.postgresql.org Subject: Re: size of table + toasted tables + indexes != pg_total_relation_size In-Reply-To: (Mariel Cherkassky's message of "Sun, 4 Nov 2018 12:14:04 +0200") Message-ID: <87pnvl2gki.fsf@news-spur.riddles.org.uk> References: User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.1 (berkeley-unix) Date: Sun, 04 Nov 2018 12:12:41 +0000 MIME-Version: 1.0 Content-Type: text/plain List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk >>>>> "Mariel" == Mariel Cherkassky writes: Mariel> output : Mariel> image.png In future please use plain text for query output, not screenshots Mariel> When I searched for the biggest objects in DB1 I saw that the Mariel> total sum isnt even close to 100G : You should probably check whether there are files in the db's directory that do not correspond to the filenode of any table (use select pg_relation_filenode(oid) from pg_class; to get a list of filenodes) Crashes (or other unclean shutdown) in the middle of doing a vacuum full or other table-rewriting operation is known to leave orphaned files around in the data dir. Mariel> Now, I thought that the pg_total_relation_size should include Mariel> also all the dead tuples and the toasted tables. It does, and your results agree with that. Perhaps you missed that pg_table_size() includes the toast table too? Mariel> In addition, I saw from pg_stat_activity that the session table Mariel> has about 198 dead tuples and the toasted table has about 83833 Mariel> dead tuples. It seems that the autoanalyze has never run on the Mariel> toasted table. There's nothing in a toast table that needs analyzing. -- Andrew (irc:RhodiumToad)