Quantcast
Channel: SCN: Message List - SAP Applications on SAP Adaptive Server Enterprise (SAP ASE)
Viewing all articles
Browse latest Browse all 3678

how to choose index on query?

$
0
0

Suppose I have following query:

select *

from tab1 a join tab2 b on a.id = b.id

where a.c1 = @v1

and a.c2 = @v2

and b.c3= @v3

 

Indexes created on id, c1, c2 on tab1, on id, c3 on tab2.

Suppose a.c2=@v2 can reduce result set much better than a.c1=@v1.

 

Question: how to force query plan use index on a.c2 firstly to reduce result set as soon as possible? If the order of condition in where clause impact performance? for example,  any difference with following where clause:

 

where

a.c1 = @v1

and a.c2 = @v2

and b.c3= @v3

 

where

a.c2 = @v2

and a.c1 = @v1

and b.c3= @v3

 

is it possible to force query plan to apply indexes like ind1, ind2, idn3....for better performance?


Viewing all articles
Browse latest Browse all 3678

Trending Articles