October 18, 2012 at 4:59 pm
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
October 19, 2012 at 12:47 am
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;-)
October 19, 2012 at 8:10 am
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
October 22, 2012 at 3:02 pm
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.
Viewing 4 posts - 1 through 3 (of 3 total)
You must be logged in to reply to this topic. Login to reply