3

So I have a few dozen empty tables with foreign keys to other, populated tables. These tables are not being accessed by any CRUD operations, but have about 6-12 months before they can be unlinked from Entity Framework applications (due to project timelines) and so are sticking around for a while.

These tables will definitely never be used again and any relationships are already documented / unnecessary to retain.

Does dropping these foreign keys have any benefits?

  • 1
    I can't think of a single benefit to dropping them as opposed to just leaving them alone. – Aaron Bertrand Dec 16 '15 at 18:03
0

The FK would still need to check with the empty table to see if the key was used on a delete operation. But this would be a quick check and never deny if the table is empty.

| improve this answer | |
0

It seems you don't have use for the tables as well as their foreign keys. Dropping them along with tables would probably release any reserved space for these tables. That could be the only benefit. In view of maintenance, it is that much less to worry about if those tables are not there. So, I would not just remove the foreign keys, but also the tables. Just removing the foreign keys would mean that you can freely truncate these tables, but that's about it.

I am not sure how it affects entity framework. If the code ever refers to the ORM object referencing the table, then it is unwise to delete the tables and for that matter the foreign keys as well because the reference has foreign key details too.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.