I have a SQL Server 2005 database and I tried to put indexes in the appropriate fields to speed up the DELETErecords from the table with millions of rows (it big_tablehas only 3 columns), but now the execution time is DELETEeven longer! (For example, 1 hour vs 13 minutes)
I have a relationship between tables, and the column that I am filtering DELETEis in another table. for instance
DELETE FROM big_table
WHERE big_table.id_product IN (
SELECT small_table.id_product FROM small_table
WHERE small_table.id_category = 1)
By the way, I also tried:
DELETE FROM big_table
WHERE EXISTS
(SELECT 1 FROM small_table
WHERE small_table.id_product = big_table.id_product
AND small_table.id_category = 1)
and although it works a little faster than the first, it is still much slower with indexes than without.
I created indexes in these fields:
big_table.id_productsmall_table.id_productsmall_table.id_category
My .ldf file grows a lot during DELETE.
DELETE , ? , .
UPDATE
, , , , DELETE, . , , DELETE .
, DELETE, WHERE.
Odetocode.com :
" DELETE UPDATE, SELECT."
, .
bobs:
- 55
- 42 .
SELECT ( " System.OutOfMemoryException" )
2 :
SELECT * FROM big_table
WHERE big_table.id_product IN (
SELECT small_table.id_product FROM small_table
WHERE small_table.id_category = 1)
SELECT * FROM big_table
INNER JOIN small_table
ON small_table.id_product = big_table.id_product
WHERE small_table.id_category = 1
25 SQL Server 2005:
An error occurred while executing batch. Error message is: Exception of type 'System.OutOfMemoryException' was thrown.
- Xeon 7,5 . :), .
- , CREATE , ?