Solved

slow inserting into sql server

Posted on 2016-10-25
3
27 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 12

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 47

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 47

Expert Comment

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

Featured Post

Ransomware-A Revenue Bonanza for Service Providers

Ransomware – malware that gets on your customers’ computers, encrypts their data, and extorts a hefty ransom for the decryption keys – is a surging new threat.  The purpose of this eBook is to educate the reader about ransomware attacks.

Question has a verified solution.

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

Suggested Solutions

Let's review the features of new SQL Server 2012 (Denali CTP3). It listed as below: PERCENT_RANK(): PERCENT_RANK() function will returns the percentage value of rank of the values among its group. PERCENT_RANK() function value always in be…
Ever wondered why sometimes your SQL Server is slow or unresponsive with connections spiking up but by the time you go in, all is well? The following article will show you how to install and configure a SQL job that will send you email alerts includ…
Familiarize people with the process of retrieving data from SQL Server using an Access pass-thru query. Microsoft Access is a very powerful client/server development tool. One of the ways that you can retrieve data from a SQL Server is by using a pa…
This videos aims to give the viewer a basic demonstration of how a user can query current session information by using the SYS_CONTEXT function

770 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