Solved

slow inserting into sql server

Posted on 2016-10-25
3
23 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 11

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 45

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 45

Expert Comment

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

Featured Post

Enabling OSINT in Activity Based Intelligence

Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

Join & Write a Comment

I wrote this interesting script that really help me find jobs or procedures when working in a huge environment. I could I have written it as a Procedure but then I would have to have it on each machine or have a link to a server-related search that …
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…
Via a live example, show how to setup several different housekeeping processes for a SQL Server.
Viewers will learn how to use the UPDATE and DELETE statements to change or remove existing data from their tables. Make a table: Update a specific column given a specific row using the UPDATE statement: Remove a set of values using the DELETE s…

743 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

Need Help in Real-Time?

Connect with top rated Experts

9 Experts available now in Live!

Get 1:1 Help Now