Re: Compound keys and foreign constraints - Mailing list pgsql-general

From Alvaro Herrera
Subject Re: Compound keys and foreign constraints
Date
Msg-id 20040402183331.GE9801@dcc.uchile.cl
Whole thread Raw
In response to Re: Compound keys and foreign constraints  (<wespvp@syntegra.com>)
Responses Re: Compound keys and foreign constraints
List pgsql-general
On Fri, Apr 02, 2004 at 11:08:21AM -0600, wespvp@syntegra.com wrote:

> db=> explain analyze select count(*) from messages m, message_recipients r,
> addresses a WHERE r.Message_Key=m.Message_Key AND
> a.Address='joe.user@testdomain.com' AND a.Address_Key=r.Recipient AND (
> (m.Message_Date >= '29-MAR-04') AND (m.Message_Date <=
> TO_TIMESTAMP('31-MAR-04 23:59:59', 'dd-mon-yy HH24:MI:SS')::timestamp
> without time zone));
>
> QUERY PLAN
> ----------------------------------------------------------------------------
> ----------------------------------------------------------------------------
> ------------------------------------------------------------------
[...]

>                ->  Index Scan using message_recipients_i_recipient on
> message_recipients r  (cost=0.00..30569.25 rows=30622 width=21) (actual
> time=83.146..31609.149 rows=312741 loops=1)

This estimate is off by an order of magnitude.  Maybe you want to
increase the statistic target for this column ...

--
Alvaro Herrera (<alvherre[a]dcc.uchile.cl>)
"The Postgresql hackers have what I call a "NASA space shot" mentality.
Quite refreshing in a world of "weekend drag racer" developers."
(Scott Marlowe)

pgsql-general by date:

Previous
From: Randall Skelton
Date:
Subject: Storage cost of a null column
Next
From: Joe Sunday
Date:
Subject: Re: ERROR: column 'xxx' does not exist (under v. 7.4.1)