Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1eJLJs-0004mM-KN for pgsql-general@arkaria.postgresql.org; Mon, 27 Nov 2017 15:27:40 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1eJLJr-0008Cs-Pf for pgsql-general@arkaria.postgresql.org; Mon, 27 Nov 2017 15:27:39 +0000 Received: from makus.postgresql.org ([2001:4800:1501:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1eJLJr-0008Ci-B9 for pgsql-general@lists.postgresql.org; Mon, 27 Nov 2017 15:27:39 +0000 Received: from mail-wr0-x235.google.com ([2a00:1450:400c:c0c::235]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1eJLJo-0001ud-DX for pgsql-general@postgresql.org; Mon, 27 Nov 2017 15:27:37 +0000 Received: by mail-wr0-x235.google.com with SMTP id l22so26737478wrc.11 for ; Mon, 27 Nov 2017 07:27:36 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=2ndquadrant-com.20150623.gappssmtp.com; s=20150623; h=subject:to:references:from:message-id:date:user-agent:mime-version :in-reply-to:content-language:content-transfer-encoding; bh=pwC6DcS8yxvh6qteTxvqcSMFpVGoWco9ZoLNiqvlYVk=; b=tm+aVO4CqEeT5945+SrpMfMalC9MB/Ahwhe3koW/HfB2Xk6uPnN20awkFP03RBOD8e aXe0gC9NNLuH7L8gHjMTJtNHh6kT44dAgeMt1CKCp2eBbtiOkYUP0/vrAgog65NPx/C2 zpvUZA20qBSsoc6RQOneK1dR5qD0HstS1Ya5WEl8AkwmzNx9JsFNsTbOvgepkyaD6l5w aLK9jlRXgjzprrGHcn+KiWmOEK5POaSc+2KffFvlhqfdorcmJnwlL5nL6jAdXJvmYFDH 5Zr+iITD5GiW/NgD03uxlzVeSNJxn6s2RheQStAldHoo2X3suWSR8VI6HAY8XhMNu96x xUTA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=pwC6DcS8yxvh6qteTxvqcSMFpVGoWco9ZoLNiqvlYVk=; b=ibElUQC9mWyAwqp3StjYk65CzGb8gMI1/7fqAqQoXaAkrrIVKDLSlh0gHGmoAR0BTe GqRMpK8ZyVzhKMdy9E8UkUoDfYBps8D+PWZM2nskn471Fgov5GSNKqpx21OX7MEyH1Rc lM3pvqlOm3JjgDlM1RDgm57Ra7MpILR4o5auqEPahPMoi2Zaugtk5FxmQO/iMiTn3rNc Sy6wtMNhny8SxWe8OEyJmgAP8nrceAEccqvuyJhKfpWr9G3QB75XxY6UfuY78SE3nTt7 bKA8vEgFs2d1MA7MGrtUfB7Bfkmu7N47Ev5jvakAHsyQTtirEr9CslPABHr0U2NR78MX Jz6g== X-Gm-Message-State: AJaThX6onXYJO4o9KNTdXaBHE12y/aK3uwFrw4QL1xHK0iW9aDrbVDVm wvDIHoHES/BdDQkpAdQ8XlB2lHUpbxIa5Fy8bEO+kYl2uCbZfykU+4I/fOyvzmS7GabSX+15T7g OpI0FElpVYFpjWJLszcIHU3rQF6O2B+enA6RoYHx9R8yPK4JQsvbgjzwwDfRM2LyX5hFynlL+/J j4pFKiiQ+/ X-Google-Smtp-Source: AGs4zMbWQrfFHPrSqc9TlWAfQacQcPSTUotmeKlRrPIeKXW7Mxm74OT/TTNvxZAYG/RKh4Bp5Sy2jg== X-Received: by 10.223.161.222 with SMTP id v30mr28923404wrv.191.1511796454318; Mon, 27 Nov 2017 07:27:34 -0800 (PST) Received: from [10.137.2.19] (ip-78-102-97-226.net.upcbroadband.cz. [78.102.97.226]) by smtp.gmail.com with ESMTPSA id c3sm12677348wrf.21.2017.11.27.07.27.33 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 27 Nov 2017 07:27:33 -0800 (PST) Subject: Re: a question about oddities in the data directory To: Martin Mueller , "pgsql-general@postgresql.org" References: <7EF5A48E-74A7-4FD2-A79E-CD62960E0921@northwestern.edu> From: Tomas Vondra Message-ID: Date: Mon, 27 Nov 2017 16:27:31 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.3.0 MIME-Version: 1.0 In-Reply-To: <7EF5A48E-74A7-4FD2-A79E-CD62960E0921@northwestern.edu> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 8bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk Hi, I think you need to read this: https://www.postgresql.org/docs/current/static/storage-file-layout.html On 11/27/2017 04:19 PM, Martin Mueller wrote: > Apologies if I asked this question before. > > I’m a newcomer to Postgres, having migrated from Mysql. Information > about tables seems harder to get at in Postgres. That data directory > on my machine is suspiciously large—well over 100 GB. The directory > Postgres/var-9.5/base/ contains a number of subdirectories with > Arabic numerals. Each of those directories stores data for a single database. Each object (including databases) has a 32-bit identifier, mapping it to object on the filesystem. databases: SELECT oid, datname FROM pg_database; tables etc.: SELECT relfilenode, relname FROM pg_class; > Directory 16385 has a subdirectory 17463 with a size of 1.07 GB. That's not a subdirectory, but a datafile segment. > But there are also 17 subdirectories with names from 17463.1 to > 17.463.17. There are also other entries with similar forms of > duplication and suspiciously identical file sizes of 1.07GB. > Again, those are files, not subdirectories. Large datafiles are split into 1GB segments, so for example 10GB table with relfilenode 17463 will be stored in files 17463, 17463.1, 17463.2, ..., 17463.9 > Is this normal behavior? Where in the postgres documentation do I > read up on this? Postgres strikes me as superior to MySQl, especially > with regard to string functions and regular expressions, but it’s > harder to look under the hood. https://www.postgresql.org/docs/current/static/storage-file-layout.html > How, for instance, do I figure out what number corresponds to the > table that I know as ‘earlyprinttuples > SELECT relfilenode FROM pg_class WHERE relname = 'earlyprinttuples'; regards -- Tomas Vondra http://www.2ndQuadrant.com PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services