Lets say i have a view
I select from that view with a where clause like
where xyz = 12
it takes 1 second to return
then i select the same view with xyz = 14
it takes 1 second to return
then i select from the view where
xyz in (12,14) why would it take 20 seconds for that data to come back if seperately it only took 2 seconds...
Check the execution plan. It may use Scan when you use in.|||use OR instead of IN and post back the result.
select *from yourview where xyz=14 or xyz=12
and also tell us what all are the index on this table
Madhu
|||You can compare the execution plans. The query optimizer use different strategy when dealing with the OR operator in the "where" clause. Sometimes it is better to use the "union all" of both separated statements.
select * from vw_v1 where xyz = 12
union all
select * from vw_v1 where xyz = 14
AMB
No comments:
Post a Comment