Q: Structured index - which one runs faster?

From: Ernest E Vogelsinger <ernest(at)vogelsinger(dot)at>
To: "pgsql-admin" <pgsql-admin(at)postgresql(dot)org>, "pgsql-general" <pgsql-general(at)postgresql(dot)org>
Subject: Q: Structured index - which one runs faster?
Date: 2003-05-22 13:20:13
Message-ID: 5.1.1.6.2.20030522150710.03f96ab8@mail.vogelsinger.at
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-admin pgsql-general

Hi all,

I have a question concerning table/key layout.

I need to store an ID value that consists of three numerical elements:
- ident1 char(5)
- ident2 char(5)
- nodeid int4

I need an index on these columns. Insert, delete, and lookup operations
this in this need to be as fast as possible. Now I have two options:

(a) creating an index on all three columns, or
(b) create a single varchar column combining all three components into a
single string, like "ident1:ident2:nodeid" and indexing this column only.

There will be a couple of million rows in this table, the values in
question are not unique.

Which would be faster in your opinion? (a) or (b)?

Thanks for any insight,

--
>O Ernest E. Vogelsinger
(\) ICQ #13394035
^ http://www.vogelsinger.at/

Browse pgsql-admin by date

  From Date Subject
Next Message boggss 2003-05-22 13:29:59 system variables
Previous Message Eugene M. Zheganin 2003-05-22 12:37:01 Re: Full vacuuming of BIG tables takes too long

Browse pgsql-general by date

  From Date Subject
Next Message lists 2003-05-22 13:58:01 Re: BUG in lower
Previous Message Holger Klawitter 2003-05-22 13:19:13 BUG in lower