index usage in various scenarious - Mailing list pgsql-general

From adam.slachta
Subject index usage in various scenarious
Date
Msg-id 4DAFA33BD6E846C98B792974740C872C@milano
Whole thread Raw
List 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 dayJ

 

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@DB_LINK_NAME MC

where MC.BUSINESSDATE = '17.11.2008';

xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

 

Adam Slachta

 

 

pgsql-general by date:

Previous
From: Pavel Stehule
Date:
Subject: Re: Evidently no support for the mmddyyyy date format
Next
From: bfb21@comcast.net
Date:
Subject: Re: Evidently no support for the mmddyyyy date format