SQL Clone
SQLServerCentral is supported by Redgate
 
Log in  ::  Register  ::  Not logged in
 
 
 


CXPACKET on Inserting


CXPACKET on Inserting

Author
Message
winston Smith
winston Smith
SSCommitted
SSCommitted (1.8K reputation)SSCommitted (1.8K reputation)SSCommitted (1.8K reputation)SSCommitted (1.8K reputation)SSCommitted (1.8K reputation)SSCommitted (1.8K reputation)SSCommitted (1.8K reputation)SSCommitted (1.8K reputation)

Group: General Forum Members
Points: 1767 Visits: 2064
I came across a database today that was doing a lot of inserting onto a table. It was taking an exceptionally long time. On clearing the Wait Stats, the CXPACKET wait type kept coming to the top of the list. Generally CXPACKET is considered a secondary wait type, caused by some other issue. Im having trouble identifying what this main issue is though.

-The query is using a Parallel plan, utilizing most of the processors.
-The table being inserted into has no indexes of any type, I guess to speed up insert.
-Processor affinity is set to use 7 procs for processing & 1 for IO.

The job has complete, and I cant run it again so im a bit stuck with regard to reproducing and nailing down the cause of the issue, but any speculation would be much appreciated.
murthykalyani
murthykalyani
SSChasing Mays
SSChasing Mays (644 reputation)SSChasing Mays (644 reputation)SSChasing Mays (644 reputation)SSChasing Mays (644 reputation)SSChasing Mays (644 reputation)SSChasing Mays (644 reputation)SSChasing Mays (644 reputation)SSChasing Mays (644 reputation)

Group: General Forum Members
Points: 644 Visits: 1382
I haven't comeacross CXPACKET waittype while inserting data.

Mostly sql server decides whether to execute the query on parallel threads or not, based on the estimate time the query completes i.e "cost threshold for parallelism". If sql server estimates that if the query takes more than 5 seconds then parallelism is kicked off, the session that is executing SQL will be executed on parallel threads if any of the threads yields or still executing and if other threads completed their tasks are waiting for completion of the thread that has yielded or still executing, then you will see CXPACKET waittype for threads that have completed its task and other waittype for the thread that is still executing.

Are you populating table through a query, if so please have fine tuned your query so that you don't run into issue, if you still run into issue you can suppress parallelism by calling maxdop query hint in your query and specificying value 1 so that your query runs only on one thread.



murthykalyani
murthykalyani
SSChasing Mays
SSChasing Mays (644 reputation)SSChasing Mays (644 reputation)SSChasing Mays (644 reputation)SSChasing Mays (644 reputation)SSChasing Mays (644 reputation)SSChasing Mays (644 reputation)SSChasing Mays (644 reputation)SSChasing Mays (644 reputation)

Group: General Forum Members
Points: 644 Visits: 1382
murthykalyani (10/31/2013)


I haven't comeacross CXPACKET waittype while inserting data.

Mostly sql server decides whether to execute the query on parallel threads or not, based on the estimate time the query completes i.e "cost threshold for parallelism". If sql server estimates that if the query takes more than 5 seconds then parallelism is kicked off, the session that is executing SQL will be executed on parallel threads if any of the threads yields or still executing and if other threads completed their tasks are waiting for completion of the thread that has yielded or still executing, then you will see CXPACKET waittype for threads that have completed its task and other waittype for the thread that is still executing.

Are you populating table through a query, if so please have fine tuned your query so that you don't run into issue, if you still run into issue you can suppress parallelism by calling maxdop query hint in your query and specificying value 1 so that your query runs only on one thread.




Bhuvnesh
Bhuvnesh
SSCertifiable
SSCertifiable (5.2K reputation)SSCertifiable (5.2K reputation)SSCertifiable (5.2K reputation)SSCertifiable (5.2K reputation)SSCertifiable (5.2K reputation)SSCertifiable (5.2K reputation)SSCertifiable (5.2K reputation)SSCertifiable (5.2K reputation)

Group: General Forum Members
Points: 5186 Visits: 4076
winston Smith (10/31/2013)
I came across a database today that was doing a lot of inserting onto a table. It was taking an exceptionally long time.
How much data you are dealing with here ? is it periodic task or one time execution ?

-------Bhuvnesh----------
I work only to learn Sql Server...though my company pays me for getting their stuff done;-)
winston Smith
winston Smith
SSCommitted
SSCommitted (1.8K reputation)SSCommitted (1.8K reputation)SSCommitted (1.8K reputation)SSCommitted (1.8K reputation)SSCommitted (1.8K reputation)SSCommitted (1.8K reputation)SSCommitted (1.8K reputation)SSCommitted (1.8K reputation)

Group: General Forum Members
Points: 1767 Visits: 2064
Hey Guys.

I was viewing the information incorrectly and so phrased the problem incorrectly.
The waits were not due to the insert, but the select statement that was being used as the source for the insert, which makes things a lot clearer.

As inserts cant be parallel, the parallel plans were coming from the select statement used as the source for the insert.
Next step is to have a look at that statement and identify areas where it can be improved by rewriting, indexing etc.

Apols for any time wasted due to my incorrect posing of the question.
Bhuvnesh
Bhuvnesh
SSCertifiable
SSCertifiable (5.2K reputation)SSCertifiable (5.2K reputation)SSCertifiable (5.2K reputation)SSCertifiable (5.2K reputation)SSCertifiable (5.2K reputation)SSCertifiable (5.2K reputation)SSCertifiable (5.2K reputation)SSCertifiable (5.2K reputation)

Group: General Forum Members
Points: 5186 Visits: 4076
you havent answered my question ? as it might help us to frame resolution for ur issue.

-------Bhuvnesh----------
I work only to learn Sql Server...though my company pays me for getting their stuff done;-)
Steven.Wright
Steven.Wright
Grasshopper
Grasshopper (13 reputation)Grasshopper (13 reputation)Grasshopper (13 reputation)Grasshopper (13 reputation)Grasshopper (13 reputation)Grasshopper (13 reputation)Grasshopper (13 reputation)Grasshopper (13 reputation)

Group: General Forum Members
Points: 13 Visits: 98
If this is an OLAP environment CXPACKET is a good thing, and you would want it to be > 10%. If this is an OLTP environment CXPACKET > 5% would indicate a problem.

Google "SQL Server 2005 Waits and Queues".
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