pg.ddx.io  pgsql-performance@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Richard Huxton <dev@archonet.com>
To: Dean Gibson (DB Administrator) <postgresql@ultimeth.com>
Cc: pgsql-performance@postgresql.org
Subject: Re: Optimizing No matching record Queries
Date: Wed, 13 Feb 2008 08:54:48 +0000
Message-ID: <47B2B058.7020804@archonet.com> (raw)
In-Reply-To: <47B234C1.1090707@ultimeth.com>
References: <47B2112C.5070707@livedatagroup.com>
	<47B234C1.1090707@ultimeth.com>

Dean Gibson (DB Administrator) wrote:
> The questions are:
> 
> 1. Why in the planner scanning the entire idx_listing_entrydate, when 
> I'd think it should be scanning the entire 
> pk_listingstatus_listingstatusid ?

It's looking at the ORDER BY and sees that the query needs the 10 most 
recent, so tries searching by date. That's sensible where you are going 
to have a lot of matches for fklistingsourceid.

Which suggests that statistics for "fklistingsourceid" aren't high 
enough, like Greg suggested. If that doesn't help, the index on 
(fklistingsourceid,entrydate) that Stephen might well do so.

> 2. Why is "Index Scan using pk_listingstatus_listingstatusid on 
> listingstatus listingsta1_  (cost=0.00..0.27 rows=1 width=4) (never 
> executed)" ?

Because nothing comes out of the first index-scan.

-- 
   Richard Huxton
   Archonet Ltd



view thread (7+ messages)  latest in thread

Message-ID: <47B2B058.7020804@archonet.com>
Permalink:  ../47B2B058.7020804@archonet.com/
Also on:    postgresql.org/message-id/47B2B058.7020804@archonet.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 using the --to and --cc options:
  reply via email

  To: pgsql-performance@postgresql.org
  Cc: dev@archonet.com, postgresql@ultimeth.com
  Subject: Re: Optimizing No matching record Queries
  In-Reply-To: <47B2B058.7020804@archonet.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