Click here to monitor SSC
SQLServerCentral is supported by Redgate
 
Log in  ::  Register  ::  Not logged in
 
 
 
        
Home       Members    Calendar    Who's On


Add to briefcase

higher cpu execution time Expand / Collapse
Author
Message
Posted Wednesday, June 19, 2013 12:38 AM
SSC Veteran

SSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC Veteran

Group: General Forum Members
Last Login: Wednesday, March 30, 2016 6:29 AM
Points: 275, Visits: 1,781
I have a very simple query to select all columns from a table if a particular column does not a character...but its cpu time is very high



total_cpu_time: 2953125
total_execution_count: 7
number_of_statements:1



what could be the probable reason for this ...
Post #1464957
Posted Wednesday, June 19, 2013 12:59 AM


SSC-Forever

SSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-Forever

Group: General Forum Members
Last Login: Today @ 2:48 AM
Points: 44,611, Visits: 42,363
No idea. Not enough information.

Please post query, table definition and index definitions,



Gail Shaw
Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability

We walk in the dark places no others will enter
We stand on the bridge and no one may pass

Post #1464966
Posted Tuesday, August 6, 2013 10:03 AM
SSC-Addicted

SSC-AddictedSSC-AddictedSSC-AddictedSSC-AddictedSSC-AddictedSSC-AddictedSSC-AddictedSSC-Addicted

Group: General Forum Members
Last Login: 2 days ago @ 7:58 AM
Points: 414, Visits: 891
Can you share the table definition, query, and number of unfiltered rows in the table?
Post #1481422
Posted Tuesday, August 6, 2013 11:00 AM


SSChampion

SSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampion

Group: General Forum Members
Last Login: Yesterday @ 8:00 PM
Points: 14,323, Visits: 37,402

well in general, "particular column does not a character" would mean a NOT LIKE '%X%' pr PATINDEX =0, right?, so that would requre a table scan of all rows, so i'm no suprised it has a big impact; every value has to be evaluated.
that would not be Sargable, so it cannot use an index.


Lowell

--
help us help you! If you post a question, make sure you include a CREATE TABLE... statement and INSERT INTO... statement into that table to give the volunteers here representative data. with your description of the problem, we can provide a tested, verifiable solution to your question! asking the question the right way gets you a tested answer the fastest way possible!
Post #1481456
Posted Tuesday, August 6, 2013 4:07 PM


SSC Eights!

SSC Eights!SSC Eights!SSC Eights!SSC Eights!SSC Eights!SSC Eights!SSC Eights!SSC Eights!

Group: General Forum Members
Last Login: Saturday, April 9, 2016 11:35 AM
Points: 878, Visits: 841
Lowell (8/6/2013)

well in general, "particular column does not a character" would mean a NOT LIKE '%X%' pr PATINDEX =0, right?, so that would requre a table scan of all rows, so i'm no suprised it has a big impact; every value has to be evaluated.


And furthermore, it requires a full scan of every column value, which is very expensive if the full rules of Unicode must be applied. Which they must, unless any of the below are true:
1) You have a binary collation.
2) The column is varchar and you have an SQL collation.


Erland Sommarskog, SQL Server MVP, www.sommarskog.se
Post #1481599
« Prev Topic | Next Topic »

Add to briefcase

Permissions Expand / Collapse