Re: why my query is not using index?? - Mailing list pgsql-performance

From Tom Lane
Subject Re: why my query is not using index??
Date
Msg-id 28283.1097558813@sss.pgh.pa.us
Whole thread Raw
In response to Re: why my query is not using index??  (Francisco Reyes <lists@natserv.com>)
List pgsql-performance
Francisco Reyes <lists@natserv.com> writes:
> With explain analyze I have with sequential scan on
> Sort  (cost=382.01..382.15 rows=56 width=196)
> (actual time=64.346..64.469 rows=24 loops=1)

> And with seqscan off
> Sort  (cost=490.82..490.96 rows=56 width=196)
> (actual time=56.668..56.789 rows=24 loops=1)

> So I guess that for this particular query I am better off setting the
> seqscan off.

For that kind of margin, you'd be a fool to do any such thing.

You might want to look at making some adjustment to random_page_cost
to bring the estimated costs in line with reality (though I'd counsel
taking more than one example into account while you tweak it).  But
setting seqscan off as a production setting is just a recipe for
shooting yourself in the foot.

            regards, tom lane

pgsql-performance by date:

Previous
From: Gabriele Bartolini
Date:
Subject: Re: Normal case or bad query plan?
Next
From: Tom Lane
Date:
Subject: Re: Normal case or bad query plan?