Deleting large no of rows with foreign key and mirroring setup

  • Hi,

    We have a database. It is enabled for mirroring. We need to delete the old records. That is around 500k records from a table. But it has foreign key relation. Can any one has good suggestion how to do in Production servers these kind of deletes

  • ramana3327 (2/19/2015)


    Hi,

    We have a database. It is enabled for mirroring. We need to delete the old records. That is around 500k records from a table. But it has foreign key relation. Can any one has good suggestion how to do in Production servers these kind of deletes

    If the table is being referenced by a foreign key constraint, deleting the data will cause orphaned records in the referencing table, suggest you look into Using DELETE CASCADE Option for Foreign Keys[/url]

    😎

  • Script the delete to do one row at a time.

    Run it in test. see how often you have to make a backup of the log to keep it from growing too large.

Viewing 3 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic. Login to reply