Re: UNIQUE( col1, col2 ) creates what indexes? - Mailing list pgsql-general

From Rob Hoopman
Subject Re: UNIQUE( col1, col2 ) creates what indexes?
Date
Msg-id 3C8A5C73.3010103@tuna.nl
Whole thread Raw
In response to UNIQUE( col1, col2 ) creates what indexes?  (Rob Hoopman <rob@tuna.nl>)
List 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


pgsql-general by date:

Previous
From: Tom Lane
Date:
Subject: Re: UNIQUE( col1, col2 ) creates what indexes?
Next
From: Bruce Momjian
Date:
Subject: Re: Fsync on/off For Various Filesystems/Platforms (Ending