X-Original-To: pgsql-admin-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 5303E3A516B for ; Wed, 26 Jan 2005 09:36:16 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 92520-07 for ; Wed, 26 Jan 2005 09:35:59 +0000 (GMT) Received: from rproxy.gmail.com (rproxy.gmail.com [64.233.170.193]) by svr1.postgresql.org (Postfix) with ESMTP id 3954F3A5B07 for ; Wed, 26 Jan 2005 09:36:00 +0000 (GMT) Received: by rproxy.gmail.com with SMTP id a36so21104rnf for ; Wed, 26 Jan 2005 01:36:00 -0800 (PST) DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:message-id:date:from:reply-to:to:subject:in-reply-to:mime-version:content-type:content-transfer-encoding:references; b=ErI6bKYMTpTSIDuhcoiSzZIYODB1zXFwc8wvaL19BI4evCMBeYwmn1BVvhJz/whbqD6PuRWe6+OgyHK68/k0lQ7Hhvnxu1tquYxa1gQJdZqe1gCM+L7C0Cc2sJUgaLFY2wsIobDT5c0UfNKsClWMg1EQzoRmknK2uXhn6pn3CyE= Received: by 10.38.97.74 with SMTP id u74mr144759rnb; Wed, 26 Jan 2005 01:36:00 -0800 (PST) Received: by 10.38.163.47 with HTTP; Wed, 26 Jan 2005 01:36:00 -0800 (PST) Message-ID: <758d5e7f0501260136310da4ec@mail.gmail.com> Date: Wed, 26 Jan 2005 10:36:00 +0100 From: Dawid Kuroczko Reply-To: Dawid Kuroczko To: pgsql-admin@postgresql.org Subject: Re: [Fwd: how to determine storage size of a numeric column] In-Reply-To: <41F70949.9080001@sermonaudio.com> Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit References: <41F70949.9080001@sermonaudio.com> X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.553 tagged_above=0 required=5 tests=AWL, FROM_ENDS_IN_NUMS, RCVD_BY_IP X-Spam-Level: X-Archive-Number: 200501/267 X-Sequence-Number: 16126 On Tue, 25 Jan 2005 22:06:49 -0500, Chris Hoover wrote: > From: Chris Hoover > To: psql-admin@postgresql.org > Date: Tue, 25 Jan 2005 16:27:45 -0500 > Subject: how to determine storage size of a numeric column > I'm running 7.3.4, and am trying to calculate the space requirements for > my tables. However, I have several tables that have numeric columns, > and am not sure how much space postgres is using for them. Does anyone > know how to determine this? > > I have tried looking at pg_attribute.attlen, but it is -l, I have tried > looking at pg_attribute.atttypmod, but it is returning what would be > huge space requirements (some of them are 786,4400, 786442, 1,179,645, . > . .). Is that number really how many bytes it is taking up? I am > thinking (and hoping) not. > > So, where else can I look for the size? Be sure to use ANALYZE first. You may want to use following select to find these values: select attname,avg_width from pg_stats where tablename = 'foo'; ...it certainly works well for me, v8 though. :) Regards, Dawid