After checking the SSIS package (due to the fact that SQL Server was executing commands very slowly), which was installed on our client about 5-4 years before I wrote this, I found that the following tasks exist: 1) Insert data from an XML file into a table named [Importbarcdes].
2) combine the team with another target table using the above table as a source.
3) "delete from [Importbarcodes]" to clear the table of the row that was inserted after the XML file was read by the SSIS package task.
After quickly checking all the statements (SELECT, UPDATE, DELETE, etc.) in the ImportBarcodes table, which has only 1 row, the execution took about 2 minutes.
Extended events showed many PAGEIOLATCH_EX pending notifications.
There are no indexes in the table and no triggers are registered.
After a thorough study of the properties of the table on the "Storage" tab and in the general section in the "Data Space" field, more than 6 GBA of space allocated in the pages was shown.
What happened:
Over the past 4 years, the query has been executed for a considerable time every day, inserting and deleting data into the table, leaving unused page files without releasing them.
Thus, this was the main reason for the wait events that were captured by the extended event session and the slowly executing commands on the table.
Running ALTER TABLE ImportBarcodes REBUILD problem, freeing up all unused space. TRUNCATE TABLE ImportBarcodes did the same, with the only difference being that it deleted all the paging files and data.
jimas13 Jul 26 '19 at 12:59 on 2019-07-26 12:59
source share