pg.ddx.io  pgsql-admin@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Ernest E Vogelsinger <ernest@vogelsinger.at>
To: pgsql-admin <pgsql-admin@postgresql.org>
To: pgsql-general <pgsql-general@postgresql.org>
Subject: Q: Structured index - which one runs faster?
Date: Thu, 22 May 2003 15:20:13 +0200
Message-ID: <5.1.1.6.2.20030522150710.03f96ab8@mail.vogelsinger.at> (raw)

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/





view thread (15+ messages)  latest in thread

Message-ID: <5.1.1.6.2.20030522150710.03f96ab8@mail.vogelsinger.at>
Permalink:  ../5.1.1.6.2.20030522150710.03f96ab8@mail.vogelsinger.at/
Also on:    postgresql.org/message-id/5.1.1.6.2.20030522150710.03f96ab8@mail.vogelsinger.at

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-admin@postgresql.org
  Cc: ernest@vogelsinger.at, pgsql-general@postgresql.org
  Subject: Re: Q: Structured index - which one runs faster?
  In-Reply-To: <5.1.1.6.2.20030522150710.03f96ab8@mail.vogelsinger.at>
  References: <5.1.1.6.2.20030522150710.03f96ab8@mail.vogelsinger.at>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox