Re: Having MANY MANY empty columns in database

From: Craig Ringer <craig(at)postnewspapers(dot)com(dot)au>
To: sathiya psql <sathiya(dot)psql(at)gmail(dot)com>
Cc: pgsql-performance(at)postgresql(dot)org
Subject: Re: Having MANY MANY empty columns in database
Date: 2008-03-22 08:24:17
Message-ID: 47E4C231.20302@postnewspapers.com.au
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-performance


> 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

In response to

Responses

Browse pgsql-performance by date

  From Date Subject
Next Message sathiya psql 2008-03-22 09:08:25 Re: Having MANY MANY empty columns in database
Previous Message sathiya psql 2008-03-22 04:10:02 Having MANY MANY empty columns in database