Database Administrators Stack Exchange is a question and answer site for database professionals who wish to improve their database skills and learn from others in the community. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have a few dozen tables, that have data in them, both for the core set of data, and then the company specific data.

I can never delete the core set of data, that is global for all companies.

But i want to be able to help identify orphan data.

Data that is inactive, but hasn't been deleted.

I do not need a query, I can figure that out myself.

Just some ideas on best practices, to help identify then get rid of orphan data, which hopefully will trim the database size down.


share|improve this question
hmm... if you already "know" wich data is irrelevant just backup and start deleting, can't think of anything else. If someone has a better way, please, speak up, I would love to know. – eiefai Mar 9 '11 at 21:10
up vote 3 down vote accepted

I would suggest duplicating the table structure in a different schema (backup) and move the data from the one table to the other. That way it can be managed effectively. But if you know what's orphaned, then why would you keep it? What purpose will it serve?

share|improve this answer

You can DELETE FROM table; safely if you foreign keys prevent deletion of still referenced rows.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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