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.
| Author |
Topic |
|
OBINNA_EKE
Posting Yak Master
234 Posts |
Posted - 2010-03-27 : 00:38:09
|
| I have a view called "iViewProperties" which contains other tables and views.Now when I run "SELECT * FROM iViewProperties" it runs unders 1 secs on SQL 2005 Serverbut when I run it with group e.g"SELECT DISTINCT TOP (100) PERCENT COUNT(PropertyID) AS NoOfProperties, BuildingType, BuildingTypeID, PropertyType, CompanyIDFROM dbo.iViewPropertiesWHERE (CompanyID = 33)GROUP BY Online, IsDeleted, BuildingType, BuildingTypeID, PropertyType, CompanyIDHAVING (Online = 1) AND (IsDeleted = 0) AND PropertyType > 0"it takes 9 secs which is unacceptable, I have only 4500 rows in the view.What can I do to speed it up?ThanksIf it is that easy, everybody will be doing it |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2010-03-27 : 02:24:13
|
| have you checked the execution plan? what does it suggest?------------------------------------------------------------------------------------------------------SQL Server MVPhttp://visakhm.blogspot.com/ |
 |
|
|
|
|
|