Deletes takes a long time, but CPU, Disk and RAM untroubled...why ?

  • Hi all,

    Running SQL 2012 BI on a spanky new server with 2690 x 2 CPU, fast SSD, ramdisk for tempdb and 128GB RAM. I have a problem finding a performance bottleneck, in essence.

    Deleting records on a where condition is a the simplest example, but some select queries exhibit this behaviour too, for part of their runtime. Back to the delete example!

    If CPU idles at 3 or 4% whilst the delete is running.

    And RAM use is 13GB of 128GB

    And Disk is idling at a few K per second

    Why does this delete operation take minutes ? Why wouldn't SQL use more resources to get the job done faster ?

    Regards, Greg.

  • Deleting records on a where condition is a the simplest example, but some select queries exhibit this behaviour too, for part of their runtime.

    What kind of behaviour are you talking about exactly? How many records do you select/delete?

    Lots of things can cause slow performance.

    Without having more detailed informations we can only guess. Can be missing indexes, too many indexes, locking and blocking issues, triggers getting activates etc.

    Oh, and btw do you really have 2690 x 2 CPU's :-)?

    [font="Verdana"]Markus Bohse[/font]

  • Hi Markus,

    Yes, I see what you mean, but...

    I'm running these query tests standalone so no other users in the way.

    1) There are no triggers on the table

    2) It's just 1 table

    3) How could it be being blocked, I wonder ?

    I suppose (regardless of the details of the query) I have a conceptual problem to get my head around - which is - why doesn't SQL use more of the resources on the server to do the job faster ?

    All I can think of that might slow it down is some kind of locking.blocking - but I can't think where this might be coming from, when the behaviour is noted in a simple delete statement.

  • greg.bull (9/24/2013)


    Why does this delete operation take minutes ? Why wouldn't SQL use more resources to get the job done faster ?

    Can you post exec plan along with sql and table defintion .

    -------Bhuvnesh----------
    I work only to learn Sql Server...though my company pays me for getting their stuff done;-)

  • What are the data types of the tsble, are there any large data types ie VARCHAR(MAX),TEXT etc.

    What is the data size of the whole table.

    Is it waiting to get exclusive access to the table

    SELECT * from sys.sysprocesses where blocked <> 0.

  • Check sys.dm_exec_requests while the query is running to understand what is causing it to wait. That's the best method. Anything else is just guessing.

    "The credit belongs to the man who is actually in the arena, whose face is marred by dust and sweat and blood"
    - Theodore Roosevelt

    Author of:
    SQL Server Execution Plans
    SQL Server Query Performance Tuning

  • 1) sp_whoisactive (sqlblog.com I think version 11.11 is latest)

    2) track_waitstats_2005 (found in the sql server 2005 waits and queues white paper IIRC) to do a wait stats analysis

    3) run a file IO stall analysis

    Download my Tune Like a Guru presentation here: http://sqlsaturday.com/81/schedule.aspx. I have both file IO and waitstats stuff there. Every client I ever help out is taught to run those three things IMMEDIATELY and WITHOUT THOUGHT as the first response to a performance issue. One or more of them will point you in the right direction the vast majority of the time. I note they won't help you FIX a problem if you find it though! 😎

    Best,
    Kevin G. Boles
    SQL Server Consultant
    SQL MVP 2007-2012
    TheSQLGuru on googles mail service

  • greg.bull (9/24/2013)


    ...

    If CPU idles at 3 or 4% whilst the delete is running.

    And RAM use is 13GB of 128GB

    And Disk is idling at a few K per second

    ...

    How many cores are there?

    [font="Times New Roman"]-- RBarryYoung[/font], [font="Times New Roman"] (302)375-0451[/font] blog: MovingSQL.com, Twitter: @RBarryYoung[font="Arial Black"]
    Proactive Performance Solutions, Inc.
    [/font]
    [font="Verdana"] "Performance is our middle name."[/font]

  • 16 hyper threaded up to 32

  • All I can think of here then is that some tasks (ie, a delete, or an insert exec) cannot be parallelised, regardless of server settings. So, in effect the bottleneck I'm seeing is CPU. Just a hunch really as 32 cores / 3 or 4% utilistation is about 1 core...

    Thanks to everyone who contributed.

    Regards, Greg.

  • greg.bull (9/24/2013)


    3) How could it be being blocked, I wonder ?

    If you have FK keys referencing this table then there are chances that you can experience blocking.

    what is the value of maximum degree of parallelism defined?

    Pramod
    SQL Server DBA | MCSE SQL Server 2012/2014

    in.linkedin.com/in/pramodsingla/
    http://pramodsingla.wordpress.com/

Viewing 11 posts - 1 through 10 (of 10 total)

You must be logged in to reply to this topic. Login to reply