From: | "adam(dot)slachta" <adam(dot)slachta(at)xitee(dot)com> |
---|---|
To: | <pgsql-general(at)postgresql(dot)org> |
Subject: | index usage in various scenarious |
Date: | 2009-04-10 11:57:20 |
Message-ID: | 4DAFA33BD6E846C98B792974740C872C@milano |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
Hello,
QUESTION1: Can somebody clarify in what of the proposed scenarios is the
following index used? Any further comment will be greatly appreciated.
QUESTION2: Does any other scenarios when an index is NOT used (and someone
might possibly expect it is used) come to your mind? Thank you very much for
your time and wish you a happy day:-)
CREATE INDEX idx_margincall_bussdt ON margincall USING btree (businessdate);
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
SCENARIO 1:
select MC.IDTRADINGACCOUNT
from MARGINCALL MC
join DEFAULTINGACCOUNT DA on DA.BUSINESSDATE = MC.BUSINESSDATE
and DA.IDTRADINGACCOUNT = MC.IDTRADINGACCOUNT
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
SCENARIO 2:
select MC.IDTRADINGACCOUNT
from MARGINCALL MC
where MC.BUSINESSDATE = '17.11.2008';
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
SCENARIO 3:
select MC.IDTRADINGACCOUNT
from MARGINCALL MC
join DEFAULTINGACCOUNT DA on DA.BUSINESSDATE = MC.BUSINESSDATE
and DA.IDTRADINGACCOUNT = MC.IDTRADINGACCOUNT
where MC.BUSINESSDATE = '17.11.2008';
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
SCENARIO 4 + QUESTION:
Is usage of indexes during execution of queries affected by db-links?
E.g.:
select MC.IDTRADINGACCOUNT
from MARGINCALL(at)DB_LINK_NAME MC
where MC.BUSINESSDATE = '17.11.2008';
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Adam Slachta
From | Date | Subject | |
---|---|---|---|
Next Message | Justin Funk | 2009-04-10 14:15:56 | Querying a Large Partitioned DB |
Previous Message | Pavel Stehule | 2009-04-10 09:40:21 | Re: Evidently no support for the mmddyyyy date format |