Re: Unable to use index? - Mailing list pgsql-general

From Tom Lane
Subject Re: Unable to use index?
Date
Msg-id 20319.1083297675@sss.pgh.pa.us
Whole thread Raw
In response to Re: Unable to use index?  (Edmund Dengler <edmundd@eSentire.com>)
List pgsql-general
Edmund Dengler <edmundd@eSentire.com> writes:
> Hmm, interesting as I have that table clustered starting with the
> rep_component, so 'ps_probe' will definitely appear later in a sequential
> scan. So why does the <order by> force the use of the index?

It does not "force" anything, it simply alters the cost estimates.  The
seqscan-based plan requires an extra sort step to meet the ORDER BY,
while the indexscan plan does not.  In this particular scenario the
indexscan plan is estimated to beat seqscan+sort, but in other cases the
opposite decision might be made.

            regards, tom lane

pgsql-general by date:

Previous
From: Tom Lane
Date:
Subject: Re: postgresql idle
Next
From: Tom Lane
Date:
Subject: Re: TCP only listening on localhost???