Re: Index ot being used

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Madison Kelly <linux(at)alteeve(dot)com>
Cc: pgsql-performance(at)postgresql(dot)org, Bruno Wolff III <bruno(at)wolff(dot)to>
Subject: Re: Index ot being used
Date: 2005-06-13 21:00:04
Message-ID: 3643.1118696404@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-performance

Madison Kelly <linux(at)alteeve(dot)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

In response to

Responses

Browse pgsql-performance by date

  From Date Subject
Next Message Madison Kelly 2005-06-13 21:18:51 Pseudo-Solved was: (Re: Index ot being used)
Previous Message Greg Stark 2005-06-13 20:53:51 Re: Index ot being used