Sql-server – Improve performance in Deletion Operation

sql serversql-server-2008sql-server-2012t-sql

I Am doing Import Process of half a million records.
Initially i will move the .csv file data to a sql table,then i will parse the records (Split the records to different tables and then parse) and move it to corresponding table. After completion of import I need to delete the .csv file imported data from tables(Main table=1 and split tables=20).

It takes more time to delete the data. I have check the indexes.

Main Table has totally 61 columns.
Split tables have maximum of 5 to 6 columns within we have Link to parent table and foreign key combination.

Similarly there multiple import process running simultaneously. We need to delete the records related to our record Import ID., here TRUNCATE Cannot be used.

Best Answer

TRUNCATE the tables that you need to have the imported data removed from.

https://docs.microsoft.com/en-us/sql/t-sql/statements/truncate-table-transact-sql?view=sql-server-ver15