Re: Compound keys and foreign constraints

From: Alvaro Herrera <alvherre(at)dcc(dot)uchile(dot)cl>
To: wespvp(at)syntegra(dot)com
Cc: Manfred Koizar <mkoi-pg(at)aon(dot)at>, pgsql <pgsql-general(at)postgresql(dot)org>
Subject: Re: Compound keys and foreign constraints
Date: 2004-04-02 18:33:31
Message-ID: 20040402183331.GE9801@dcc.uchile.cl
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Fri, Apr 02, 2004 at 11:08:21AM -0600, wespvp(at)syntegra(dot)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(dot)user(at)testdomain(dot)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)

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Joe Sunday 2004-04-02 19:17:42 Re: ERROR: column 'xxx' does not exist (under v. 7.4.1)
Previous Message John DeSoi 2004-04-02 18:27:38 Re: row-level security model