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
 SQL Server 2000 Forums
 Transact-SQL (2000)
 problem with view

Author  Topic 

AskSQLTeam
Ask SQLTeam Question

0 Posts

Posted - 2004-06-08 : 08:05:00
greenland writes "Hi,
Recently, one of our customers complained about runnning a view is taking long time when he put where clause on a column to search null data.

I tested it by connecting to his server as follows:

1)select col1,col2,col3 from my_view

returned 152 rows in about 8 seconds. 4 of those rows with valid col3 value and remaining 148 row with 'NULL' in col3.

2)select col1,col2,col3 from my_view where col3 in not null

returned 4 rows in 3 seconds.

3)select col1,col2,col3 from my_view where col3 in null

This statement taking forever.

I backedup all his database and put it on our local server and tested all above scenarios and they are working fine!! The third statement returned in 6 seconds on our local server!

And also I checked index on base tables and everyhing is fine.
Please advice.
Thanks."

graz
Chief SQLTeam Crack Dealer

4149 Posts

Posted - 2004-06-08 : 08:05:00
I really hope that you're really typing IS NULL and not IN NULL. Is that correct?
Go to Top of Page

greenland
Starting Member

1 Post

Posted - 2004-06-08 : 10:13:18
quote:
Originally posted by graz

I really hope that you're really typing IS NULL and not IN NULL. Is that correct?


Yes, I was checking for 'IS NULL' and 'IS NOT NULL'.
Sorry for typo error in my original message.
Thanks.
Go to Top of Page

kselvia
Aged Yak Warrior

526 Posts

Posted - 2004-06-08 : 12:24:44
Can you post the view?
Go to Top of Page

tfountain
Constraint Violating Yak Guru

491 Posts

Posted - 2004-06-08 : 13:36:19
Paste the query that is taking forever into Query Analyzer and press CTRL-L to display the execution plan. That should identify where the bottle neck is. My guess is if it runs bad on your clients box but runs fine on yours with the same data then it's probably an issue where you have a better box than the client, thus negating the performance degradation on your end. Even if that is the case, on either end you should be able to look at the execution plan and identify the bottleneck.
Go to Top of Page
   

- Advertisement -