Re: Q: Structured index - which one runs faster?

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
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: Q: Structured index - which one runs faster?
Date: 2003-05-22 22:53:00
Message-ID: 11951.1053643980@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-admin pgsql-general pgsql-performance

Ernest E Vogelsinger <ernest(at)vogelsinger(dot)at> writes:
> (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.

I can't imagine that (b) is a good idea ... it's dubious that you are
saving anything on the indexing, and you're sure adding a lot of space
to the table, not to mention maintenance effort, potential for bugs,
etc.

It might be worth creating the index so that the "least non-unique"
column is mentioned first, if there's a clear winner in those terms.
That would minimize the number of times that comparisons have to look at
the additional columns.

regards, tom lane

In response to

Responses

Browse pgsql-admin by date

  From Date Subject
Next Message Stephan Szabo 2003-05-22 23:00:54 Re: [ADMIN] Q: Structured index - which one runs faster?
Previous Message scott.marlowe 2003-05-22 22:23:44 Re: [GENERAL] Q: Structured index - which one runs faster?

Browse pgsql-general by date

  From Date Subject
Next Message John Gray 2003-05-22 22:56:53 Re: Max String length?
Previous Message Tom Lane 2003-05-22 22:40:26 Re: Query failed: ERROR: catalog is missing 1 attribute(s) for relid 456086

Browse pgsql-performance by date

  From Date Subject
Next Message Stephan Szabo 2003-05-22 23:00:54 Re: [ADMIN] Q: Structured index - which one runs faster?
Previous Message scott.marlowe 2003-05-22 22:23:44 Re: [GENERAL] Q: Structured index - which one runs faster?