Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

slow inserting into sql server

Posted on 2016-10-25
3
Medium Priority
?
42 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 14

Accepted Solution

by:
Nakul Vachhrajani earned 1000 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 52

Assisted Solution

by:Vitor Montalvão
Vitor Montalvão earned 1000 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 52

Expert Comment

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

Featured Post

Enroll in September's Course of the Month

This month’s featured course covers 16 hours of training in installation, management, and deployment of VMware vSphere virtualization environments. It's free for Premium Members, Team Accounts, and Qualified Experts!

Question has a verified solution.

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

A Stored Procedure in Microsoft SQL Server is a powerful feature that it can be used to execute the Data Manipulation Language (DML) or Data Definition Language (DDL). Depending on business requirements, a single Stored Procedure can return differe…
Recently we ran in to an issue while running some SQL jobs where we were trying to process the cubes.  We got an error saying failure stating 'NT SERVICE\SQLSERVERAGENT does not have access to Analysis Services. So this is a way to automate that wit…
Via a live example, show how to extract information from SQL Server on Database, Connection and Server properties
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.

670 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