|  | Posted by Alexander Kuznetsov on 04/03/06 19:57 
I addition to Tony's post, I'd say that SQL Server's optimizer may beconfused by views. For instance, here is a situation I sometimes come
 across:
 
 select ... from some_view where
 ---- a very very very selective predicate on an indexed column
 last_name like 'Zar%'
 
 Unfortunately, the optimizer won't push the highly selective predicate
 down the view's definition, so the query will run very slowly. However,
 if you rewrite the query without using the view, the optimizer will
 choose a better plan using the index on last_name.
 
 One may hope that eventually SQL Server will ahve a better
 implementation of views, but for the time being in a SQL Server
 environment I would use views in moderation.
  Navigation: [Reply to this message] |