Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
 
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: Sunday, September 21, 2014 10:47 PM
Points: 269, Visits: 1,732
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-Dedicated

SSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-Dedicated

Group: General Forum Members
Last Login: Today @ 7:50 AM
Points: 39,977, Visits: 36,339
No idea. Not enough information.

Please post query, table definition and index definitions,



Gail Shaw
Microsoft Certified Master: SQL Server 2008, MVP
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
Old Hand

Old HandOld HandOld HandOld HandOld HandOld HandOld HandOld Hand

Group: General Forum Members
Last Login: Today @ 10:15 AM
Points: 348, Visits: 704
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: Today @ 9:55 AM
Points: 12,902, Visits: 32,141

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

--There is no spoon, and there's no default ORDER BY in sql server either.
Actually, Common Sense is so rare, it should be considered a Superpower. --my son
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: Wednesday, September 24, 2014 1:24 PM
Points: 805, Visits: 722
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