pg.ddx.io  pgsql-performance@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Bryan Murphy <bmurphy1976@gmail.com>
Cc: Josh Berkus <josh@agliodbs.com>
Cc: pgsql-performance@postgresql.org
Subject: Re: Help Me Understand Why I'm Getting a Bad Query Plan
Date: Wed, 25 Mar 2009 22:15:14 -0400
Message-ID: <11650.1238033714@sss.pgh.pa.us> (raw)
In-Reply-To: <7fd310d10903251514x1dd522f3o8d13a9218a6eda6c@mail.gmail.com>
References: <7fd310d10903231203r1bd37b8cn8baeadae83253f44@mail.gmail.com>
	<7fd310d10903241521v1cbf5d7aueca653e03ed98649@mail.gmail.com>
	<b1b9fac60903242004p5fe8b68fwd6f1ada767766b21@mail.gmail.com>
	<7fd310d10903242047t1a7b7daw1d61c3de7f20b7c6@mail.gmail.com>
	<49CAA85C.8080402@agliodbs.com>
	<7fd310d10903251514x1dd522f3o8d13a9218a6eda6c@mail.gmail.com>

Bryan Murphy <bmurphy1976@gmail.com> writes:
> I tried that already, but I decided to try again in case I messed up
> something last time.  Here's what I ran.  As you can see, it still
> chooses to do a sequential scan.  Am I changing the stats for those
> columns correctly?

I think what you should be doing is messing with the cost parameters
... and not in the direction you tried before.  I gather from
	effective_cache_size = 12GB
that you have plenty of RAM on this machine.  If the tables involved
are less than 1GB then it's likely that you are operating in a fully
cached condition, and the default cost parameters are not set up for
that.  You want to be charging a lot less for page accesses relative to
CPU effort.  Try reducing both seq_page_cost and random_page_cost to 0.5
or even 0.1.  You'll need to watch your other queries to make sure
nothing gets radically worse though ...

			regards, tom lane



view thread (14+ messages)  latest in thread

Message-ID: <11650.1238033714@sss.pgh.pa.us>
Permalink:  ../11650.1238033714@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/11650.1238033714@sss.pgh.pa.us

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-performance@postgresql.org
  Cc: tgl@sss.pgh.pa.us, bmurphy1976@gmail.com, josh@agliodbs.com
  Subject: Re: Help Me Understand Why I'm Getting a Bad Query Plan
  In-Reply-To: <11650.1238033714@sss.pgh.pa.us>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox