• GilaMonster - Friday, February 9, 2018 5:29 AM

    If there aren't too many foreign keys and the amount you're deleting is more than the amount of rows you want to keep, it may well be faster to insert the rows you want to keep into a new table, drop the old table and then rename the new one (and put all the keys and indexes back afterwards)

    That's a good idea. But should I include it in a transaction? If you can post a sample code, it will be ideal. Thanks