Search Postgresql Archives

Re: Compound keys and foreign constraints

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



> 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


---------------------------(end of broadcast)---------------------------
TIP 7: don't forget to increase your free space map settings

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux