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, July 20, 2014 10:15 PM
Points: 265, Visits: 1,713
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 @ 3:17 PM
Points: 42,450, Visits: 35,505
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: 2 days ago @ 9:26 AM
Points: 341, Visits: 682
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 @ 8:24 PM
Points: 12,881, Visits: 31,816

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


Right there with Babe

Right there with BabeRight there with BabeRight there with BabeRight there with BabeRight there with BabeRight there with BabeRight there with BabeRight there with Babe

Group: General Forum Members
Last Login: 2 days ago @ 2:28 PM
Points: 786, Visits: 691
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