Click here to monitor SSC
SQLServerCentral is supported by Redgate
 
Log in  ::  Register  ::  Not logged in
 
 
 


sp_columns performance change


sp_columns performance change

Author
Message
Chad Crawford
 Chad Crawford
SSCrazy
SSCrazy (2.4K reputation)SSCrazy (2.4K reputation)SSCrazy (2.4K reputation)SSCrazy (2.4K reputation)SSCrazy (2.4K reputation)SSCrazy (2.4K reputation)SSCrazy (2.4K reputation)SSCrazy (2.4K reputation)

Group: General Forum Members
Points: 2438 Visits: 18651
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
Bhuvnesh
Bhuvnesh
SSCrazy
SSCrazy (2.9K reputation)SSCrazy (2.9K reputation)SSCrazy (2.9K reputation)SSCrazy (2.9K reputation)SSCrazy (2.9K reputation)SSCrazy (2.9K reputation)SSCrazy (2.9K reputation)SSCrazy (2.9K reputation)

Group: General Forum Members
Points: 2928 Visits: 4076
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;-)
Chad Crawford
 Chad Crawford
SSCrazy
SSCrazy (2.4K reputation)SSCrazy (2.4K reputation)SSCrazy (2.4K reputation)SSCrazy (2.4K reputation)SSCrazy (2.4K reputation)SSCrazy (2.4K reputation)SSCrazy (2.4K reputation)SSCrazy (2.4K reputation)

Group: General Forum Members
Points: 2438 Visits: 18651
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. Sad

Chad
clubbavich
clubbavich
SSC Journeyman
SSC Journeyman (85 reputation)SSC Journeyman (85 reputation)SSC Journeyman (85 reputation)SSC Journeyman (85 reputation)SSC Journeyman (85 reputation)SSC Journeyman (85 reputation)SSC Journeyman (85 reputation)SSC Journeyman (85 reputation)

Group: General Forum Members
Points: 85 Visits: 1032
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.
Go


Permissions

You can't post new topics.
You can't post topic replies.
You can't post new polls.
You can't post replies to polls.
You can't edit your own topics.
You can't delete your own topics.
You can't edit other topics.
You can't delete other topics.
You can't edit your own posts.
You can't edit other posts.
You can't delete your own posts.
You can't delete other posts.
You can't post events.
You can't edit your own events.
You can't edit other events.
You can't delete your own events.
You can't delete other events.
You can't send private messages.
You can't send emails.
You can read topics.
You can't vote in polls.
You can't upload attachments.
You can download attachments.
You can't post HTML code.
You can't edit HTML code.
You can't post IFCode.
You can't post JavaScript.
You can post emoticons.
You can't post or upload images.

Select a forum

































































































































































SQLServerCentral


Search