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

From: Stephan Szabo <sszabo(at)megazone23(dot)bigpanda(dot)com>
To: Ernest E Vogelsinger <ernest(at)vogelsinger(dot)at>
Cc: pgsql-performance <pgsql-performance(at)postgresql(dot)org>
Subject: Re: [ADMIN] Q: Structured index - which one runs faster?
Date: 2003-05-23 06:42:36
Message-ID: 20030522233646.Y58014-100000@megazone23.bigpanda.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-admin pgsql-general pgsql-performance


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.

In response to

Browse pgsql-admin by date

  From Date Subject
Next Message Mendola Gaetano 2003-05-23 07:51:57 What is going on?
Previous Message Dawn Hollingsworth 2003-05-23 03:20:43 Database Backup/Restore with Inherited Tables

Browse pgsql-general by date

  From Date Subject
Next Message Stephan Szabo 2003-05-23 06:46:35 Re: deadlocks problem
Previous Message Christopher Kings-Lynne 2003-05-23 05:55:38 phpPgAdmin 3.0 Beta 1 Released

Browse pgsql-performance by date

  From Date Subject
Next Message Vivek Khera 2003-05-23 15:09:00 Re: [ADMIN] Q: Structured index - which one runs faster?
Previous Message Tom Lane 2003-05-23 00:00:14 Re: Q: Structured index - which one runs faster?