pg.ddx.io  pgsql-performance@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Bryan Murphy <bmurphy1976@gmail.com>
To: Josh Berkus <josh@agliodbs.com>
Cc: pgsql-performance@postgresql.org
Subject: Re: Help Me Understand Why I'm Getting a Bad Query Plan
Date: Tue, 24 Mar 2009 22:43:37 -0500
Message-ID: <7fd310d10903242043x28d24adenb729c0a77a21ce9@mail.gmail.com> (raw)
In-Reply-To: <49C99732.8080703@agliodbs.com>
References: <7fd310d10903231203r1bd37b8cn8baeadae83253f44@mail.gmail.com>
	<7fd310d10903241521t645462bdpb3b8aee40b4f3ae4@mail.gmail.com>
	<49C99732.8080703@agliodbs.com>

On Tue, Mar 24, 2009 at 9:30 PM, Josh Berkus <josh@agliodbs.com> wrote:
> For some reason, your first post didn't make it to the list, which is why
> nobody responded.

Weird... I've been having problems with gmail and google reader all week.

>>> I've got a query on our production system that isn't choosing a good
>>> plan.  I can't see why it's choosing to do a sequential scan on the
>>> ItemExperienceLog table.  That table is about 800mb and has about 2.5
>>> million records.  This example query only returns 4 records.  I've
>>> tried upping the statics for ItemExperienceLog.VistorId and
>>> ItemExperienceLog.ItemId to 1000 (from out default of 100) with no
>>> success.
>
> Yes, that is kind of inexplicable.  For some reason, it's assigning a very
> high cost to the nestloops, which is why it wants to avoid them with a seq
> scan.  Can you try lowering cpu_index_cost to 0.001 and see how that affects
> the plan?

I'm assuming you meant cpu_index_tuple_cost.  I changed that to 0.001
as you suggested, forced postgres to reload it's configuration and I'm
still getting the same execution plan.

Looking through our configuration one more time, I see that at some
point I set random_page_cost to 2.0, but I don't see any other changes
to query planner settings from their default values.

Bryan



view thread (14+ messages)  latest in thread

Message-ID: <7fd310d10903242043x28d24adenb729c0a77a21ce9@mail.gmail.com>
Permalink:  ../7fd310d10903242043x28d24adenb729c0a77a21ce9@mail.gmail.com/
Also on:    postgresql.org/message-id/7fd310d10903242043x28d24adenb729c0a77a21ce9@mail.gmail.com

 · 

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 from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-performance@postgresql.org
  Cc: bmurphy1976@gmail.com, josh@agliodbs.com
  Subject: Re: Help Me Understand Why I'm Getting a Bad Query Plan
  In-Reply-To: <7fd310d10903242043x28d24adenb729c0a77a21ce9@mail.gmail.com>
  References: <7fd310d10903231203r1bd37b8cn8baeadae83253f44@mail.gmail.com> <7fd310d10903241521t645462bdpb3b8aee40b4f3ae4@mail.gmail.com> <49C99732.8080703@agliodbs.com> <7fd310d10903242043x28d24adenb729c0a77a21ce9@mail.gmail.com>

* 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