pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Masaru Sugawara <rk73@echna.ne.jp>
To: pgsql-sql@postgresql.org
Subject: Re: Why would this slow the query down so much?
Date: Wed, 17 Oct 2001 23:21:30 +0900
Message-ID: <20011017215538.5D57.RK73@echna.ne.jp> (raw)
In-Reply-To: <E15tXY1-0005ZQ-00@garner.smgsystems.co.uk>
References: <14373.1003158756@sss.pgh.pa.us>
	<E15tXY1-0005ZQ-00@garner.smgsystems.co.uk>

On Tue, 16 Oct 2001 17:58:32 +0100
Stuart Grimshaw wrote:

> On Monday 15 October 2001 16:12 pm, Tom Lane wrote:
> > Stuart Grimshaw <nospam@smgsystems.co.uk> writes:
> > > SELECT a.category, b.headline, b.added, c.friendlyname
> > > FROM caturljoin as a
> > >         INNER JOIN stories as b ON (a.url = b.source)
> > >         INNER JOIN urllist as c ON (a.url = d.urn)
> > > WHERE a.category = 93 ORDER BY b.added DESC LIMIT 1;
> >
> > (I assume "d.urn" is a typo for "c.urn"...)
> >
> > The query plan you show looks pretty reasonable if the planner's row
> > count estimates are in the right ballpark.  How many caturljoin rows
> > have category = 93?  How many stories rows will match each caturljoin
> > row?  How many urllist rows ditto?
> 
> There are 194 rows in caturljoin where url = 93, 29806 rows in stories will 
> match those 194 rows and only 1 row in urllist will match.
> 

 If it's convenient, would you try to delete some indices 
 of the "stories" table?  the total number of sorts on the
 QUERY PLAN might decrease.  However, this trial may be a 
 vain effort. I can't expect the result of the QUERY PLAN.  :-)
 
 
 The indices: "stories_source",
              "stories_unique_story",
              and "stories_urn_key"


Regards,
Masaru Sugawara




view thread (5+ messages)

Message-ID: <20011017215538.5D57.RK73@echna.ne.jp>
Permalink:  ../20011017215538.5D57.RK73@echna.ne.jp/
Also on:    postgresql.org/message-id/20011017215538.5D57.RK73@echna.ne.jp

 · 

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-sql@postgresql.org
  Cc: rk73@echna.ne.jp
  Subject: Re: Why would this slow the query down so much?
  In-Reply-To: <20011017215538.5D57.RK73@echna.ne.jp>

* 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