pg.ddx.io  pgsql-admin@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Stephan Szabo <sszabo@megazone23.bigpanda.com>
To: Ernest E Vogelsinger <ernest@vogelsinger.at>
Cc: pgsql-performance <pgsql-performance@postgresql.org>
Subject: Re: [ADMIN] Q: Structured index - which one runs faster?
Date: Thu, 22 May 2003 23:42:36 -0700 (PDT)
Message-ID: <20030522233646.Y58014-100000@megazone23.bigpanda.com> (raw)
In-Reply-To: <5.1.1.6.2.20030523012954.0400a730@mail.vogelsinger.at>


On Fri, 23 May 2003, Ernest E Vogelsinger wrote:

> Thanks for replying :)
>
> At 01:00 23.05.2003, Stephan Szabo said:
> --------------------[snip]--------------------
> >On Thu, 22 May 2003, Ernest E Vogelsinger wrote:
> >
> >> I need to store an ID value that consists of three numerical elements:
> >>     - ident1 char(5)
> >>     - ident2 char(5)
> >>     - nodeid int4
> >
> >This seems like a somewhat odd key layout, why char(5) for the first
> >two parts if they're numeric as well?
>
> It's not odd - ident1 and ident2 are in fact logical identifiers that _are_
> character values, no numbers.

The reason I mentioned it is that the original said, "three numerical
elements" ;)

> >Also, what kinds of lookups are you going to be doing?  Only lookups based
> >on all three parts of the key or will you ever be searching based on parts
> >of the keys?
>
> Hmm. Yes, lookups on parts of the keys will be possible, but only from left
> to right, ident1 having the highest precedence, followed by ident2 and
> finally by nodeid.

The multi-column index helps for those as well, as long as you put the
columns in the precedence order.  If they're ordered ident1,ident2,nodeid
then it'll potentially use it for searches on ident1 or ident1 and ident2
if it thinks that the condition is selective enough.




view thread (15+ messages)  latest in thread

Message-ID: <20030522233646.Y58014-100000@megazone23.bigpanda.com>
Permalink:  ../20030522233646.Y58014-100000@megazone23.bigpanda.com/
Also on:    postgresql.org/message-id/20030522233646.Y58014-100000@megazone23.bigpanda.com

 · 

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: sszabo@megazone23.bigpanda.com, ernest@vogelsinger.at, pgsql-performance@postgresql.org
  Subject: Re: [ADMIN] Q: Structured index - which one runs faster?
  In-Reply-To: <20030522233646.Y58014-100000@megazone23.bigpanda.com>
  References: <5.1.1.6.2.20030523012954.0400a730@mail.vogelsinger.at> <20030522233646.Y58014-100000@megazone23.bigpanda.com>

* 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