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 6791761
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T17:53:07+00:00 2026-05-26T17:53:07+00:00

I have run into an interesting problem. I have inherited a database for daemon

  • 0

I have run into an interesting problem. I have inherited a database for daemon process that polls and accepts reports from remote embedded systems. Each site that has one of these systems can monitor over a dozen different fuel tanks. (In practice, most monitor 2, 3 or 4 tanks.)

When something happens, such as a tank being refilled or a tank reaching a minimum level, the program saved that event in a Postgres database. The way the database was originally constructed, it was saving all the information from each fuel tank (type of fuel, etc.) in the event record, even though there was a separate “tanks” table. I added a foreign key field to the table to associate it with a particular embedded unit, and a foreign key to the events table to associate it with a particular tank.

Now here’s the problem: tanks can be added, removed, or have the type of fuel they store changed at any time. Adding tanks shouldn’t be a problem, but if one is removed, those event recorded would be “orphaned”. Worse if the type of fuel is changed, from say “jet” to “rocket”, then when someone searches through the history, they would think all those old events happened to the “rocket” fuel, when in fact they happened to the “jet” fuel.

I have received a couple of suggestions offline: (1) make a second, archive table of the tanks, and when anything changes, move that tank record, with its unique ID, to the archive table, and make a new record with new ID for the new state of the tank, or (2) and an “active” field to the tanks table, and still create new rows when specs change, but only flag the current state of the tanks as “active”.

Does anyone have any opinion on these proposed solutions, or another idea that might work?

  • 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-05-26T17:53:08+00:00Added an answer on May 26, 2026 at 5:53 pm

    Where’s the problem? All the relevant information is in the event record; or when you created the link between tank and event you didn’t persist the tank information? . The fact that it is orphaned isn’t a problem removing the fuel type from the event table is what caused the problem.

    There are several reasons why to persist information forward. one of which is history. By linking the tables back to a tank entity is nice it shows you what IS current state. the event table shows you history if the “type” is different than the type on the tank table..

    I guess I don’t understand the problem well enough:

    Are users wanting to see all events even if a tank is deleted?

    Would adding an associative table between tank and events for tank type with a start and end dates solve the problem?

    What’s wrong with persisting some tank information to the event? This way you know the state of the tank at the point in time the event occurred?

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

Sidebar

Related Questions

I have run into an interesting problem. I am currently developing php page and
I have run into a very interesting problem trying to debug my custom PHP
I have run into an interesting bug where it appears that when you select
I have run into an interesting problem lately: Lets say I have an array
I have run into an interesting problem which I'm pretty sure is the fault
I have run into an interesting problem with Entity Framework and based on the
We've run into an interesting situation that needs solving, and my searches have turned
I've recently run into interesting problem passing parameters to my controller action from my
I have run into a common, yet difficult problem. I do not use Photoshop
I have run into a bit of a tricky problem in some C++ code,

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.