Received: from localhost (unknown [200.46.204.183]) by postgresql.org (Postfix) with ESMTP id C84412E0065 for ; Sat, 22 Mar 2008 05:24:28 -0300 (ADT) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.183]) (amavisd-maia, port 10024) with ESMTP id 14611-02 for ; Sat, 22 Mar 2008 05:24:26 -0300 (ADT) X-Greylist: from auto-whitelisted by SQLgrey-1.7.5 Received: from www.postnewspapers.com.au (www.postnewspapers.com.au [202.61.230.242]) by postgresql.org (Postfix) with ESMTP id 1CFA22E0064 for ; Sat, 22 Mar 2008 05:24:26 -0300 (ADT) Received: from mail.postnewspapers.com.au (202-89-185-120.static.dsl.amnet.net.au [202.89.185.120]) by www.postnewspapers.com.au (Postfix) with ESMTP id 0EBC6D55A0; Sat, 22 Mar 2008 17:24:21 +0900 (WST) Received: from localhost (access [127.0.0.1]) by mail.postnewspapers.com.au (Postfix) with ESMTP id 8FF881E0435; Sat, 22 Mar 2008 17:24:21 +0900 (WST) X-Virus-Scanned: Debian amavisd-new at postnewspapers.com.au Received: from mail.postnewspapers.com.au ([127.0.0.1]) by localhost (access.postnewspapers.com.au [127.0.0.1]) (amavisd-new, port 10024) with LMTP id 7cNAv0YgQflA; Sat, 22 Mar 2008 17:24:19 +0900 (WST) Received: from [203.161.97.213] (203.161.97.213.static.amnet.net.au [203.161.97.213]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client CN "Craig Ringer", Issuer "POST Certificate Authority" (verified OK)) by mail.postnewspapers.com.au (Postfix) with ESMTP id 515221E0434; Sat, 22 Mar 2008 17:24:19 +0900 (WST) Message-ID: <47E4C231.20302@postnewspapers.com.au> Date: Sat, 22 Mar 2008 17:24:17 +0900 From: Craig Ringer User-Agent: Thunderbird 2.0.0.12 (Windows/20080213) MIME-Version: 1.0 To: sathiya psql Cc: pgsql-performance@postgresql.org Subject: Re: Having MANY MANY empty columns in database References: In-Reply-To: X-Enigmail-Version: 0.95.6 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200803/427 X-Sequence-Number: 29381 > In a database which we are having we have nearly 100 tables, and in 75% of > the tables we have 6 columns ( INT ) as standard columns. What is standard > columns, if you create a table in this database you should have some default > 6 columns in there they should maintain > 1. who is the owner of that read > 2. when it is added > 3. who is updating the record > 4. when it is updated .... and other columns.... OK, so your tables all have the same fields (columns), as if you used CREATE TABLE new_table ( LIKE some_template_table ) ? > But many of the users are not doing anything with those columns, they are > all empty always.... meaning that they contain NULL values in that field for every record? > If you drop those columns we will gain any performance or not..... The best way to find that out is to test it. I'd be surprised if it didn't make *some* performance difference, but the question is whether it will be enough to be worth caring about. However, I recall hearing that PostgreSQL keeps a null bitmap and doesn't use any storage for null fields. If that is correct then you probably won't be paying much of a price in disk I/O, but there might still be other costs. I can't help wondering why you have all those useless columns in the first place, and why you have so many identically structured tables. -- Craig Ringer