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
 Slow Query

Author  Topic 

nitsmooth
Yak Posting Veteran

68 Posts

Posted - 2012-09-25 : 10:32:15
select * from table
where Column like '' or Column like ' ' or Column is null

the table has 23 Lakh rows
i have two primary keys in the table

the query is taking almost 12 minutes to run. Is there a was i can speed this up?

Lamprey
Master Smack Fu Yak Hacker

4614 Posts

Posted - 2012-09-25 : 10:55:18
What is teh DDL of the table? Do you have any indexes on the table?

Just as a side note, the default settings for SQL is to ignore trailing spaces so: Column like '' or Column like ' ', is redundant.

Here are some links that might help give you more information about what you can post that will help us help you:
http://www.sqlservercentral.com/articles/Best+Practices/61537/
http://weblogs.sqlteam.com/brettk/archive/2005/05/25/5276.aspx
Go to Top of Page

prett
Posting Yak Master

212 Posts

Posted - 2012-09-26 : 06:23:53
The reason behind Slow query performance are due to the load on the system, and other times it is because the query is not written to perform as efficiently as possible. Please take a look of this article to improve query performance: http://www.techrepublic.com/blog/datacenter/speed-up-sql-server-database-queries-with-these-tips/173
Go to Top of Page
   

- Advertisement -