Re: UNIQUE( col1, col2 ) creates what indexes?

From: Rob Hoopman <rob(at)tuna(dot)nl>
To: pgsql-general <pgsql-general(at)postgresql(dot)org>
Subject: Re: UNIQUE( col1, col2 ) creates what indexes?
Date: 2002-03-09 19:03:15
Message-ID: 3C8A5C73.3010103@tuna.nl
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Tom Lane wrote:

>A two-column index cannot support a search based on only the second
>column. It can support a search based on only the first column,
>however. (Think about the physical index ordering to see why.)
>
I see, I'll declare a seperate index on the second column if the need
arises.

>
>Presently, EXPLAIN doesn't show you exactly what the indexscan
>conditions are, so it's not obvious what the difference is between
>your first three cases. You can figure it out if you have the patience
>to study EXPLAIN VERBOSE output, but that's pretty ugly :-(. I have
>been thinking about whether it wouldn't be possible for EXPLAIN to emit
>a pretty-printed version of the scan conditions. In that case you could
>see what was happening in examples like this.
>
To be honest I've never understood too much of the EXPLAIN output to
begin with, so I'll probably get in way over my head when I try and
understand the VERBOSE output. (Chances are I'll get it all backwards
and degrade performance instead :-( ).

Is there any recommended reading on understanding EXPLAIN/ performance
in general? There's probably more to be said on the subject than what's
in the Users Guide.

Thanks for the quick responses, mostly I just read the list and I am
impressed how fast and (mostly) on target the advice on this list often is.
( Thought I'd do some kissing up, I might have a couple more questions
over the next few days ;-)

Regards,
Rob

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Bruce Momjian 2002-03-09 21:00:04 Re: Fsync on/off For Various Filesystems/Platforms (Ending
Previous Message Tom Lane 2002-03-09 18:17:30 Re: UNIQUE( col1, col2 ) creates what indexes?