Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 Should a view be slower than a query?

Author  Topic 

Mapper
Starting Member

12 Posts

Posted - 2008-09-22 : 18:01:20
I don't quite trust a consultant. I really don't think he know what he is doing, but I wanted to check this forum to see what y'all have to say.

We are executing a query in about 3 seconds. We use the same SQL syntax to create a view and it takes about 45 seconds to return all the rows. Is this normal behavior, or does this sound fishy to you?

One other thing. I read somewhere that placing field names in brackets will speed up a view. (ie SELECT x.[OBJECTID], x.[Field1] FROM TABLE as x; rather than ie SELECT x.OBJECTID, x.Field1 FROM TABLE as x) I am just curious if this is true or not as well.

http://www.BackcountrySecrets.com - Find and share places to play outdoors

sodeep
Master Smack Fu Yak Hacker

7174 Posts

Posted - 2008-09-22 : 18:32:43
Not true. Did you compare the execution plan for both? Might be involved in blocking/locking?
Go to Top of Page

Mapper
Starting Member

12 Posts

Posted - 2008-09-22 : 18:36:27
I don't know how to compare the execution plan.

http://www.BackcountrySecrets.com - Find and share places to play outdoors
Go to Top of Page

sodeep
Master Smack Fu Yak Hacker

7174 Posts

Posted - 2008-09-22 : 18:51:59
In top of Query analyzer with Actual execution plansymbol.
Go to Top of Page
   

- Advertisement -