Solved

slow inserting into sql server

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

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 46

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

Why is this different from all of the other step by step guides?  Because I make a living as a DBA and not as a writer and I lived through this experience. Defining the name: When I talk to people they say different names on this subject stuff l…
This article explains how to reset the password of the sa account on a Microsoft SQL Server.  The steps in this article work in SQL 2005, 2008, 2008 R2, 2012, 2014 and 2016.
Via a live example, show how to extract insert data into a SQL Server database table using the Import/Export option and Bulk Insert.
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…

920 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

13 Experts available now in Live!

Get 1:1 Help Now