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

Tom Lane <tgl@sss.pgh.pa.us>

From: Tom Lane <tgl@sss.pgh.pa.us>
To: Ernest E Vogelsinger <ernest@vogelsinger.at>
Cc: "pgsql-admin" <pgsql-admin@postgresql.org>, "pgsql-general" <pgsql-general@postgresql.org>, "pgsql-performance" <pgsql-performance@postgresql.org>
Date: 2003-05-22T22:53:00Z
Lists: pgsql-performance
Ernest E Vogelsinger <ernest@vogelsinger.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