Re: [PERFORM] Forcing index scan on query produces 16x faster

2010-03-28 Thread Cédric Villemain
2010/3/25 Robert Haas : > On Wed, Mar 17, 2010 at 9:01 PM, Eger, Patrick wrote: >> I'm running 8.4.2 and have noticed a similar heavy preference for >> sequential scans and hash joins over index scans and nested loops.  Our >> database is can basically fit in cache 100% so this may not be >> appli

Re: [PERFORM] Forcing index scan on query produces 16x faster

2010-03-24 Thread Robert Haas
On Wed, Mar 24, 2010 at 8:59 PM, Eger, Patrick wrote: > Ok, the wording is a bit unclear in the documentation as to whether it is the > cost for an entire *page* of tuples, or actual tuples. So something like the > following might give better results for a fully-cached DB? > > seq_page_cost = 1.

Re: [PERFORM] Forcing index scan on query produces 16x faster

2010-03-24 Thread Eger, Patrick
Cc: Christian Brink; pgsql-performance@postgresql.org Subject: Re: [PERFORM] Forcing index scan on query produces 16x faster On Wed, Mar 17, 2010 at 9:01 PM, Eger, Patrick wrote: > I'm running 8.4.2 and have noticed a similar heavy preference for > sequential scans and hash joins over

Re: [PERFORM] Forcing index scan on query produces 16x faster

2010-03-24 Thread Robert Haas
On Wed, Mar 17, 2010 at 9:01 PM, Eger, Patrick wrote: > I'm running 8.4.2 and have noticed a similar heavy preference for > sequential scans and hash joins over index scans and nested loops.  Our > database is can basically fit in cache 100% so this may not be > applicable to your situation, but t

Re: [PERFORM] Forcing index scan on query produces 16x faster

2010-03-18 Thread Dave Crooke
though, fwiw > =) > > -Original Message- > From: pgsql-performance-ow...@postgresql.org > [mailto:pgsql-performance-ow...@postgresql.org] On Behalf Of Christian > Brink > Sent: Wednesday, March 17, 2010 2:26 PM > To: pgsql-performance@postgresql.org > Subject: [PE

Re: [PERFORM] Forcing index scan on query produces 16x faster

2010-03-17 Thread Eger, Patrick
Sent: Wednesday, March 17, 2010 2:26 PM To: pgsql-performance@postgresql.org Subject: [PERFORM] Forcing index scan on query produces 16x faster I am running into a problem with a particular query. The execution plan cost shows that the Seq Scan is a better bet (cost=54020.49..54020.55) over the forced

Re: [PERFORM] Forcing index scan on query produces 16x faster

2010-03-17 Thread Tom Lane
Christian Brink writes: > Is there a way to rewrite or hint the planner to get me the better plan > without resorting to 'enable_seqscan' manipulation (or am I missing > something)? I think your problem is here: > PostgreSQL 8.0.3 on i386-redhat-linux-gnu, compiled by GCC > i386-redhat-linu

Re: [PERFORM] Forcing index scan on query produces 16x faster

2010-03-17 Thread David Wilson
On Wed, Mar 17, 2010 at 5:25 PM, Christian Brink wrote: > > -> Index Scan using sales_tranzdate_index on sales s > (cost=0.01..1825.27 rows=22530 width=12) (actual time=0.072..3.464 rows=225 > loops=1) > Have you tried increasing the statistics on that table (and then analyzing)?

[PERFORM] Forcing index scan on query produces 16x faster

2010-03-17 Thread Christian Brink
I am running into a problem with a particular query. The execution plan cost shows that the Seq Scan is a better bet (cost=54020.49..54020.55) over the forced index 'enable_seqscan = false' (cost=1589703.87..1589703.93). But when I run the query both ways I get a vastly different result (below