Solved

slow inserting into sql server

Posted on 2016-10-25
3
30 Views
Last Modified: 2016-11-13
Hi
I have a web app which has been working fine
however, the data importer has suddenly stopped/seldom inserting
its timing out on each insert

i installed sp_whoisactive and i see the following
whoisactive
the middle row is the console import app trying to do the insert of latest log data, but it looks like a locking issue
it appears the first row is the issue?
would you agree and what should i do about it?

Can I do the I sent without lock?
The first row is get a select so no idea why it's locking????
0
Comment
Question by:websss
  • 2
3 Comments
 
LVL 13

Accepted Solution

by:
Nakul Vachhrajani earned 250 total points (awarded by participants)
ID: 41859782
Because you are inserting data, a lock is definitely required. The LCK_M_IX tells you that the system is waiting to get an Intent Exclusive lock on the system.

There are a couple of things to check for:
- Are your SELECT queries are running with TABLOCK (which should not be the case)
- Do you have well-defined clustered indexes on your table (if it's a heap, it is possible that the simplest of SELECT statements may need locks on the entire table)
- Do you use explicit, long-running transactions? Try to keep the explicit transactions as small as possible
- Check if there are any resource bottlenecks on the server (memory/CPU/disk)


I suspect that you will find long-running transactions and run-away queries (the session blocking your insert is a select, session #60 which has 2,500,000 reads! Can you look at the query and optimize it to reduce the reads?)
0
 
LVL 48

Assisted Solution

by:Vitor Montalvão
Vitor Montalvão earned 250 total points (awarded by participants)
ID: 41859928
Looks like your INSERT is being blocked by the SELECT statement.
We can't see all of the SQL commands so I'm guessing that SELECT is also querying the tblCommonTrackingData, right?
If possible post here both commands (SELECT and INSERT).
0
 
LVL 48

Expert Comment

by:Vitor Montalvão
ID: 41885222
Recommendation to close this question by accepting the above comments as solutions.
0

Featured Post

VMware Disaster Recovery and Data Protection

In this expert guide, you’ll learn about the components of a Modern Data Center. You will use cases for the value-added capabilities of Veeam®, including combining backup and replication for VMware disaster recovery and using replication for data center migration.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Nowadays, some of developer are too much worried about data. Who is using data, who is updating it etc. etc. Because, data is more costlier in term of money and information. So security of data is focusing concern in days. Lets' understand the Au…
Introduction SQL Server Integration Services can read XML files, that’s known by every BI developer.  (If you didn’t, don’t worry, I’m aiming this article at newcomers as well.) But how far can you go?  When does the XML Source component become …
Using examples as well as descriptions, and references to Books Online, show the documentation available for datatypes, explain the available data types and show how data can be passed into and out of variables.
Viewers will learn how to use the INSERT statement to insert data into their tables. It will also introduce the NULL statement, to show them what happens when no value is giving for any given column.

820 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question