Click here to Skip to main content
15,562,816 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
i work on sql server 2019 when update data on table it take too much time
so i try to see that and analysis that

SELECT [Spid] = session_Id
     , ecid
     , [Database] = DB_NAME(sp.dbid)
     , [User] = nt_username
     , [Status] = er.status
     , [Wait] = wait_type
     , [Individual Query] = SUBSTRING (qt.text, 
     (CASE WHEN er.statement_end_offset = -1
            THEN LEN(CONVERT(NVARCHAR(MAX), qt.text)) * 2
         ELSE er.statement_end_offset END - 
     ,[Parent Query] = qt.text
     , Program = program_name
     , Hostname
     , nt_domain
     , start_time
     FROM sys.dm_exec_requests er
     INNER JOIN sys.sysprocesses sp ON er.session_id = sp.spid
     CROSS APPLY sys.dm_exec_sql_text(er.sql_handle)as qt
     WHERE session_Id > 50              -- Ignore system spids.
     AND session_Id NOT IN (@@SPID)     -- Ignore this current statement.
     ORDER BY 1, 2

File sharing and storage made simple[^]

What I have tried:

update s set s.PriorityLevel='I1'   FROM s 
 inner join extractreports.dbo.SourcingNotMappedPartsIDI1 g on g.SourcingNotMappedPartsID=s.SourcingNotMappedPartsID
Meysam Toluie 8-Mar-22 6:56am    
CXPACKET wait types occurs when SQL use parallelism component. Increase Cost Threshold for Parallelism in server setting. To avoid these wait type.
ahmed_sa 10-Mar-22 14:04pm    
how to reduce it please can you please answer to me

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900