Re: Compound keys and foreign constraints

From: Wes Palmer <Wesley(dot)R(dot)Palmer(at)SYNTEGRA(dot)COM>
To: Manfred Koizar <mkoi-pg(at)aon(dot)at>
Cc: pgsql <pgsql-general(at)postgresql(dot)org>
Subject: Re: Compound keys and foreign constraints
Date: 2004-04-02 00:17:09
Message-ID: BC920D25.C132%Wesley.R.Palmer@syntegra.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

> Is there an index on message_recipients(Message_Key)?

Yes.

> How many rows satisfy
>
> SELECT * FROM messages WHERE Message_Date BETWEEN ... AND ... ?

db=> select count(*) from messages where message_date between '29-Mar-04'
and '31-Mar-04 23:59:59';
count
--------
737873
(1 row)

Other cases where the number of records are smaller result in the same plan.
Even a simple query like

select count(*) from messages where (message_key=1234) AND message_date
(between '29-Mar-04' and '31-Mar-04 23:59:59')

Will use only the message_key index if define. I've tried every query I can
think of and it won't use the compound index as long as the message_key
index is defined - which I need for the foreign constraints.

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

Default - I have not changed those. I did bump up some postgresql.conf
memory settings, but haven't touched any of the cost parameters.

Wes

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Marc G. Fournier 2004-04-02 00:26:37 Re: Some Aberdeen report
Previous Message Manfred Koizar 2004-04-02 00:00:39 Re: Compound keys and foreign constraints