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

sp_columns performance change Expand / Collapse
Author
Message
Posted Thursday, October 18, 2012 4:59 PM


SSCrazy

SSCrazySSCrazySSCrazySSCrazySSCrazySSCrazySSCrazySSCrazy

Group: General Forum Members
Last Login: Today @ 2:08 PM
Points: 2,607, Visits: 17,906
I’m trying to fix a performance issue and can’t seem to get anywhere. During our daily busy period, our CPU usage recently began to peg at 100%. We are using Ignite, and it identified one query as being responsible for most of the CPU used during that period. The query is executing the sp_columns system stored proc, which returns information about a table column, given the table and column name. This query only recently started causing issues and I can’t figure out why it suddenly cropped up. Here is what I know:
Ignite shows that:
• The number of executions has not significantly changed
• The number of reads (logical and physical) has not significantly changed
• The number of writes has changed (3x more), but 7500 writes wouldn’t seem to peg the CPU even if they all happened at once.
• The largest wait for this sproc is “CPU”, and the days when things are bad the total CPU waits are 4-5x what they are on a good day.
• The query with the next largest CPU wait values is 1/5 this one.
Last time this happened we had 1-2 really bad days, then it disappeared. This time we’ve tried updating stats (on the non-system tables) and dumping the proc cache, without any noticeable improvement.

What I can’t figure out is why a system stored proc returning table metadata would tank like this out of the blue. We haven’t made any dramatic schema changes that would mean it was spinning through more data and the number of reads confirms that. The execution duration changes (2x) and the CPU changes (1.5x), but everything else stays the same.

Any ideas why this might be? Anyone familiar with Ignite that might know something Ignite is not showing me?

Thanks,
Chad
Post #1374613
Posted Friday, October 19, 2012 12:47 AM


SSCrazy

SSCrazySSCrazySSCrazySSCrazySSCrazySSCrazySSCrazySSCrazy

Group: General Forum Members
Last Login: Monday, July 14, 2014 4:48 AM
Points: 2,834, Visits: 3,950
Chad Crawford (10/18/2012)
The query is executing the sp_columns system stored proc, which returns information about a table column, given the table and column name.
Why dont you try sys.columns or information_schema


-------Bhuvnesh----------
I work only to learn Sql Server...though my company pays me for getting their stuff done
Post #1374657
Posted Friday, October 19, 2012 8:10 AM


SSCrazy

SSCrazySSCrazySSCrazySSCrazySSCrazySSCrazySSCrazySSCrazy

Group: General Forum Members
Last Login: Today @ 2:08 PM
Points: 2,607, Visits: 17,906
Bhuvnesh (10/19/2012)
Chad Crawford (10/18/2012)
The query is executing the sp_columns system stored proc, which returns information about a table column, given the table and column name.
Why dont you try sys.columns or information_schema


That would be much better. I've asked for them to pull the reference to sp_columns completely out of the code, since they are only using it to get a list of columns they need to do an insert. Until that can be coded, QA'ed and deployed, we still have to suffer through. Do you have any ideas why performance on a system proc would suddenly change? It was working fine for years, then suddenly became an issue? Normally I would think it was statistics, but it doesn't seem you can update stats on system tables and that would imply that we had made a bunch of schema changes, which we did not.

Chad
Post #1374845
Posted Monday, October 22, 2012 3:02 PM
Valued Member

Valued MemberValued MemberValued MemberValued MemberValued MemberValued MemberValued MemberValued Member

Group: General Forum Members
Last Login: Today @ 1:41 PM
Points: 74, Visits: 766
Here's a performance "gotcha" for that specific stored procedure: http://blogs.msdn.com/b/sqlserverfaq/archive/2009/10/30/sp-columns-take-longer-in-sql-server-2005-sp3-compared-to-sql-server-2000.aspx

Basically, if the database has a table with a name containing an underscore (or another wildcard character), that stored procedure uses a much less efficient method of returning the results.
Post #1375740
« Prev Topic | Next Topic »

Add to briefcase

Permissions Expand / Collapse