Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7756051
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T12:43:13+00:00 2026-06-01T12:43:13+00:00

In a Relational Database, what is the best way to handle removing an object

  • 0

In a Relational Database, what is the best way to handle removing an object from the object graph while still retaining referential integrity? At some point, this has to happen. Either through a soft or hard delete.

For example – when a product is removed, what is the best approach to make sure that the orders containing that product are still relevant, or furthermore that invoices containing orders containing that product are still relevant?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-01T12:43:14+00:00Added an answer on June 1, 2026 at 12:43 pm

    There are basically 3 “standard solutions”:

    Solution 1

    You need the product (like in your case because of the invoices referencing it). This means the data is VALID and the only change is that it goes “out of stock” or “out of portfolio”. In any case your business process often will need you to handle RMA situations or some IRS related matters for example… this means the product must not be deleted. This is just a different “state” of the product which needs to be reflected by your DB data model etc.

    IF you are concerned with performance do some profiling… if need be you have a multitude of optimization options… these are usually RDBMS-dependent, one technique being “partitioning” – every RDBMS has its own mechanics which differ in flexibility etc.

    Solution 2

    You don’t need any of the data at all… just do a cascaded delete and be done with it…

    Solution 3

    You only need historical data but no “future business process” will ever need this entity (i.e. product) again… in this case a common solution is to have archive tables which are filled before doing a cascaeded delete on the “active/productive tables”. A slight variant of this scheme is copying the needed information into the “dependent rows” (invoice in your case) and just delete the active/productive row (i.e. product in your case).

    Conclusion

    Complex systems deal with a lot of different business processes/use cases and thus tend to employ all of the above techniques – each has its place depeding on the specific business processes/use cases involved…

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am looking for the best way to handle a database of many-to-many relationships
What would be the best way to handle the __repr__() function for an object
I'm looking for a book/site/tutorial on best practices for relational database design, tuning for
Any thoughts on the best way to implement a table (i.e. a small relational
Fairly new to relational database and to sqlite. But I'm curious what's the best
I am new to database programming and want some tips on performance / best
With the launch of Amazon's Relational Database Service today and their 'enforced' maintenance windows
If I wanted to create my own relational database with a modern language to
The benefits of a non-relational database (such as a key-value pair storage) are evident
I have quite a problem concerning the use of relational database concepts in Delphi

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.