Re: Why would this slow the query down so much? - Mailing list pgsql-sql

From Stuart Grimshaw
Subject Re: Why would this slow the query down so much?
Date
Msg-id E15tXY1-0005ZQ-00@garner.smgsystems.co.uk
Whole thread Raw
In response to Re: Why would this slow the query down so much?  (Tom Lane <tgl@sss.pgh.pa.us>)
Responses Re: Why would this slow the query down so much?  (Masaru Sugawara <rk73@echna.ne.jp>)
List pgsql-sql
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.

-- 

| Stuart Grimshaw <stuart@footballnet.com>
| Chief Operations Officer
| Football Networks Ltd
|-
| t:07976 625221
| f:0870 7060260


pgsql-sql by date:

Previous
From: "Frank Zhu"
Date:
Subject: Re: VARCHAR vs TEXT
Next
From: Frank Bax
Date:
Subject: Re: VARCHAR vs TEXT