Quantcast
Channel: Comments and answers for "Best approach to delete first 5 million rows from a heap in batches"
Browsing all 16 articles
Browse latest View live

Answer by Fatherjack

what version of SQL Server you are working with may have an effect here. You can use `TOP n` or `SET ROWCOUNT` to control the number of rows to delete on each pass. This question has a relevant answer...

View Article



Comment by Pavel Pawlowski on Fatherjack's answer

I only add, that for heap it's hard to defiine what is first 5 millions as you have no order guaranteed in the heap. You will have to provide some correct criteria, which will identify those 5 millions...

View Article

Comment by Pamz on Fatherjack's answer

Thanks for the reply. My version is sql 2008. But let me explain it a bit further; I want to delete first top 5 million in order of insertion. I already had it covered for a clustered indexed table and...

View Article

Comment by Pavel Pawlowski on Fatherjack's answer

You cannot guarantee the order of insertion during select unless you have an IDENTITY (or some time stamp column which has different timestamp for each row) column in the table. If you hwave identity...

View Article

Comment by Pamz on Fatherjack's answer

That exactly what I was thinking. But you hinted some undocumented functions. can they help?

View Article


Comment by Pavel Pawlowski on Fatherjack's answer

Those undocumented functions can help you get values in order how they are physically stored on pages, however again this does not guarantee the order of insertion.

View Article

Comment by Pamz on Fatherjack's answer

Thanks for confirming. It seems, a lot of manual work coming our way. Fingers crossed! trying to find the source files.

View Article

Answer by Pamz

I have just got the good news that source text files for the heap are available at remote site. Those would be approximately 100K size each. So here it is what we are planning to do A.Create a...

View Article


Answer by Fatherjack

what version of SQL Server you are working with may have an effect here. You can use `TOP n` or `SET ROWCOUNT` to control the number of rows to delete on each pass. This question has a relevant answer...

View Article


Comment by Pavel Pawlowski on Pavel Pawlowski's answer

I only add, that for heap it's hard to defiine what is first 5 millions as you have no order guaranteed in the heap. You will have to provide some correct criteria, which will identify those 5 millions...

View Article

Comment by Pamz on Pamz's answer

Thanks for the reply. My version is sql 2008. But let me explain it a bit further; I want to delete first top 5 million in order of insertion. I already had it covered for a clustered indexed table and...

View Article

Comment by Pavel Pawlowski on Pavel Pawlowski's answer

You cannot guarantee the order of insertion during select unless you have an IDENTITY (or some time stamp column which has different timestamp for each row) column in the table. If you hwave identity...

View Article

Comment by Pamz on Pamz's answer

That exactly what I was thinking. But you hinted some undocumented functions. can they help?

View Article


Comment by Pavel Pawlowski on Pavel Pawlowski's answer

Those undocumented functions can help you get values in order how they are physically stored on pages, however again this does not guarantee the order of insertion.

View Article

Comment by Pamz on Pamz's answer

Thanks for confirming. It seems, a lot of manual work coming our way. Fingers crossed! trying to find the source files.

View Article


Answer by Pamz

I have just got the good news that source text files for the heap are available at remote site. Those would be approximately 100K size each. So here it is what we are planning to do A.Create a...

View Article
Browsing all 16 articles
Browse latest View live




Latest Images