Re: seqscan strikes again - Mailing list pgsql-performance

From Tom Lane
Subject Re: seqscan strikes again
Date
Msg-id 6304.1100042672@sss.pgh.pa.us
Whole thread Raw
In response to seqscan strikes again  ("Jim C. Nasby" <decibel@decibel.org>)
List pgsql-performance
"Jim C. Nasby" <decibel@decibel.org> writes:
> I'm wondering if there's any way I can tweak things so that the estimate
> for the query is more accurate (I have run analyze):

>                ->  Index Scan using alert__tick_tsz on alert  (cost=0.00..2498.49 rows=7119 width=28) (actual
time=0.006..0.030rows=12 loops=1413) 
>                      Index Cond: (("outer".prev_end_time < ms_t(alert.tick)) AND ("outer".end_time >=
ms_t(alert.tick)))

Can you alter the data representation?  7.4 doesn't have any stats about
functional indexes and so it's not likely to come up with a good number
about the selectivity of the index on ms_t(tick).  It might be worth
materializing that value as a plain column and indexing the column.

(This being a join, I'm not sure it would help any, but it seems worth
trying.)

            regards, tom lane

pgsql-performance by date:

Previous
From: "Joshua D. Drake"
Date:
Subject: Re: seqscan strikes again
Next
From: Cao Duy
Date:
Subject: simple select-statement takes more than 25 sec