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 1gJLYV-0004pN-53 for pgsql-admin@arkaria.postgresql.org; Sun, 04 Nov 2018 16:47:19 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1gJLYT-0000Ui-4t for pgsql-admin@arkaria.postgresql.org; Sun, 04 Nov 2018 16:47:17 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1gJLYS-0000Ua-Q4 for pgsql-admin@lists.postgresql.org; Sun, 04 Nov 2018 16:47:16 +0000 Received: from lungold.riddles.org.uk ([82.68.208.19]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1gJLYP-0008VJ-I1 for pgsql-admin@lists.postgresql.org; Sun, 04 Nov 2018 16:47:15 +0000 Received: from [192.168.127.1] (port=30205 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 1gJLYL-000NrD-PQ; Sun, 04 Nov 2018 16:47:09 +0000 Received: from [127.0.0.1] (port=10333 helo=caithnard.riddles.org.uk) by caithnard.riddles.org.uk with esmtp (Exim 4.89 (FreeBSD)) (envelope-from ) id 1gJLYK-0004pS-HH; Sun, 04 Nov 2018 16:47:08 +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 17:09:20 +0200") Message-ID: <87d0rk3itx.fsf@news-spur.riddles.org.uk> References: <87pnvl2gki.fsf@news-spur.riddles.org.uk> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.1 (berkeley-unix) Date: Sun, 04 Nov 2018 16:47:06 +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: >> 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) Mariel> * and If i'll find some, is it safe just to delete them ?* You need to check that they're not recent (i.e. could not belong to table creations/rewrites that are still in progress, since those would not be visible in pg_class). Also make sure you're looking in the right database (using pg_relation_filepath instead may make this clearer). Remember that a given filenode/filepath also generates names with suffixes for forks (e.g. _vm) and segments (.1, .2 etc) - those need to be kept for valid filenodes and deleted along with orphaned ones. Naturally, if you get this wrong you will break your database beyond easy recovery, so BE CAREFUL. As an extra check, you could look at the times of the files and check against your server logs to see if there were indeed any crashes or unclean restarts of pg around those times; if you have a lot of apparently orphaned files you should investigate why. -- Andrew (irc:RhodiumToad)