Re: Compound keys and foreign constraints

From: Manfred Koizar <mkoi-pg(at)aon(dot)at>
To: <wespvp(at)SYNTEGRA(dot)COM>
Cc: pgsql <pgsql-general(at)postgresql(dot)org>
Subject: Re: Compound keys and foreign constraints
Date: 2004-04-02 00:00:39
Message-ID: vt9p6017tr5tfc09g1od031nbej0iibufp@email.aon.at
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Thu, 01 Apr 2004 16:45:23 -0600, <wespvp(at)SYNTEGRA(dot)COM> wrote:
>db=> explain analyze select count(*) from messages m join (select * from
>db(> message_recipients r join addresses a on a.Address_Key=r.Recipient
>where
>db(> a.Address='lra(dot)edi(at)edi(dot)cma-cgm(dot)com') as foo on
>db-> (m.Message_Key=foo.Message_Key AND (m.Message_Date >= '29-MAR-04') AND
>db(> (m.Message_Date <= '31-MAR-04 23:59:59'::timestamp without time zone));

I wonder whether we should try to talk the planner into using a hash or
merge join, but I fear I don't know enough yet.

Is there an index on message_recipients(Message_Key)?

How many rows satisfy

SELECT * FROM messages WHERE Message_Date BETWEEN ... AND ... ?

And what are your settings for random_page_cost, effective_cache_size,
and sort_mem?

Servus
Manfred

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Wes Palmer 2004-04-02 00:17:09 Re: Compound keys and foreign constraints
Previous Message wespvp 2004-04-01 22:45:23 Re: Compound keys and foreign constraints