Re: Index ot being used - Mailing list pgsql-performance

From Tom Lane
Subject Re: Index ot being used
Date
Msg-id 3643.1118696404@sss.pgh.pa.us
Whole thread Raw
In response to Re: Index ot being used  (Madison Kelly <linux@alteeve.com>)
Responses Re: Index ot being used
List pgsql-performance
Madison Kelly <linux@alteeve.com> writes:
>    So the index obiously provides a major performance boost! I just need
> to figure out how to tell the planner how to use it...

Simple division shows that the planner's cost estimate ratio between the
seqscan and the indexscan (11956.84 vs 83171.78) is off by a factor of
more than 8 compared to reality (2018.996 vs 1700.459).  Also the cost of
the sort seems to be drastically underestimated.

I suspect this may be a combination of random_page_cost being too high
(since your test case, at least, is no doubt fully cached in RAM) and
cpu_operator_cost being too low.  I'm wondering if text comparisons
are really slow on your machine --- possibly due to strcoll being
inefficient in the locale you are using, which you didn't say.  That
would account for both the seqscan being slower than expected and the
sort taking a long time.

It'd be interesting to look at the actual runtimes of this seqscan vs
one that is doing a simple integer comparison over the same number of
rows (and, preferably, returning about the same number of rows as this).

            regards, tom lane

pgsql-performance by date:

Previous
From: Greg Stark
Date:
Subject: Re: Index ot being used
Next
From: Madison Kelly
Date:
Subject: Pseudo-Solved was: (Re: Index ot being used)