SQL Server Forums
Profile | Register | Active Topics | Members | Search | Forum FAQ
 
Register Now and get your question answered!
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 Slow Query
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

nitsmooth
Yak Posting Veteran

68 Posts

Posted - 09/25/2012 :  10:32:15  Show Profile  Reply with Quote
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
Flowing Fount of Yak Knowledge

4613 Posts

Posted - 09/25/2012 :  10:55:18  Show Profile  Reply with Quote
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

USA
192 Posts

Posted - 09/26/2012 :  06:23:53  Show Profile  Visit prett's Homepage  Reply with Quote
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
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
SQL Server Forums © 2000-2009 SQLTeam Publishing, LLC Go To Top Of Page
This page was generated in 0.06 seconds. Powered By: Snitz Forums 2000