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.89) (envelope-from ) id 1iT4mZ-0001mb-3U for pgsql-hackers@arkaria.postgresql.org; Fri, 08 Nov 2019 13:58:35 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1iT4mX-0005LO-Sp for pgsql-hackers@arkaria.postgresql.org; Fri, 08 Nov 2019 13:58:33 +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_SHA1:256) (Exim 4.89) (envelope-from ) id 1iT4mX-0005Ku-KV for pgsql-hackers@lists.postgresql.org; Fri, 08 Nov 2019 13:58:33 +0000 Received: from feynman.df7cb.de ([195.49.152.168]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1iT4mV-0007Zz-55 for pgsql-hackers@postgresql.org; Fri, 08 Nov 2019 13:58:33 +0000 Received: from msg.df7cb.de (unknown [IPv6:2003:5b:203b:100:7627:eaff:fe52:8e03]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-256) server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by feynman.df7cb.de (Postfix) with ESMTPSA id 478hgp2zdNz3F19; Fri, 8 Nov 2019 14:58:30 +0100 (CET) Date: Fri, 8 Nov 2019 14:58:30 +0100 From: Christoph Berg To: Julien Rouhaud Cc: PostgreSQL Hackers Subject: Re: Monitoring disk space from within the server Message-ID: <20191108135830.GJ8017@msg.df7cb.de> Mail-Followup-To: Christoph Berg , Julien Rouhaud , PostgreSQL Hackers References: <20191108132419.GG8017@msg.df7cb.de> <20191108133531.GH8017@msg.df7cb.de> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.12.2 (2019-09-21) List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk Re: Julien Rouhaud 2019-11-08 > The related function on Windows is apparently GetDiskFreeSpaceA [1]. There's a link to GetDiskFreeSpaceExA() which seems much easier to use because it accepts any directory on the drive in question: https://docs.microsoft.com/en-us/windows/win32/api/fileapi/nf-fileapi-getdiskfreespaceexa > It'll probably be quite hard to get something consistent for most of > counters, so probably pg_tablespace_(disk_)space is the best name, > providing only total size and free size? So, how about: pg_tablespace_disk_space -> total_bytes | free_bytes The inode numbers are probably not very interesting in a PG tablespace as we don't create that many files. Or do we think including these counters (on UNIX) makes sense? There's precedents for leaving fields NULL where not supported by the OS, for example pg_stat_file() returns "change" on UNIX only, and "creation" on Windows only. Christoph