Re: [GENERAL] Q: Structured index - which one runs faster?

From: "scott(dot)marlowe" <scott(dot)marlowe(at)ihs(dot)com>
To: Ernest E Vogelsinger <ernest(at)vogelsinger(dot)at>
Cc: pgsql-admin <pgsql-admin(at)postgresql(dot)org>, pgsql-general <pgsql-general(at)postgresql(dot)org>, pgsql-performance <pgsql-performance(at)postgresql(dot)org>
Subject: Re: [GENERAL] Q: Structured index - which one runs faster?
Date: 2003-05-22 22:23:44
Message-ID: Pine.LNX.4.33.0305221623150.25804-100000@css120.ihs.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-admin pgsql-general pgsql-performance

On Thu, 22 May 2003, Ernest E Vogelsinger wrote:

> Hi all,
>
> sorry for reposting this to the lists, but I feel I posted this at the
> wrong time of day, since now a lot more of you gurus are reading, and I
> really need some knowledgeable input... thanks for consideration :)
>
>
> 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)?

Generally speaking, b should be faster, but a should be more versatile.

In response to

Browse pgsql-admin by date

  From Date Subject
Next Message Tom Lane 2003-05-22 22:53:00 Re: Q: Structured index - which one runs faster?
Previous Message Bruce Momjian 2003-05-22 22:20:54 Re: Table size on disk

Browse pgsql-general by date

  From Date Subject
Next Message Tom Lane 2003-05-22 22:40:26 Re: Query failed: ERROR: catalog is missing 1 attribute(s) for relid 456086
Previous Message Franco Bruno Borghesi 2003-05-22 21:39:15 dropped users

Browse pgsql-performance by date

  From Date Subject
Next Message Tom Lane 2003-05-22 22:53:00 Re: Q: Structured index - which one runs faster?
Previous Message Bruce Momjian 2003-05-22 21:23:41 Re: postgres on a beowulf? (AMD)opteron?