Does max size of varchar influence index size

From: Franck Routier <franck(dot)routier(at)axege(dot)com>
To: pgsql-performance(at)postgresql(dot)org
Subject: Does max size of varchar influence index size
Date: 2008-06-30 16:57:58
Message-ID: 1214845078.6710.7.camel@franck-laptop
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-performance

Hi,

I have problems with my database becoming huge in size (around 150 GB
right now, and 2/3 for only three tables, each having around 30 millions
tuples. Space is spent mainly on indices.).

I have a lot of multi-column varchar primary keys (natural keys), and
lot of foreign keys on these tables and thus a lot of indices.

When using VARCHAR, we defaulted to VARCHAR(32) (because on _some_ of
the identifiers, we have to apply md5).

We assumed that using VARCHAR(32) but having values at most 4 characters
long (for example) wouldn't influence indices size, ie it would be the
same as using VARCHAR(4) to keep the example.

Now I really doubt if we were right :)

So, what should we expect ? And are there other factors influencing
indices size ?

Thanks,
Franck

Responses

Browse pgsql-performance by date

  From Date Subject
Next Message Alvaro Herrera 2008-06-30 18:58:48 Re: VACUUM ANALYZE blocking both reads and writes to a table
Previous Message Moritz Onken 2008-06-30 16:42:07 Re: Planner should use index on a LIKE 'foo%' query