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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T01:15:12+00:00 2026-06-09T01:15:12+00:00

My entire database occasionally has entries which are wrong, but instead of altering the

  • 0

My entire database occasionally has entries which are wrong, but instead of altering the data directly I’d like the ability to keep a revision of changes.

These changes occur very rarely.

Ideally something like this: –

 (original table fields) | revision_version | origin | user | timestamp

So say I had a table called posts with the following schema: –

title | description | timestamp | author

An additional table called posts_revisions would be created thusly: –

title | description | timestamp | author | revision_version | origin | user | timestamp
  • origin being the source of the change, be it a bot, user generated or what have you.

As you can imagine this is a rather large change to the existing database, my current concern is the performance hit of checking the _revisions tables for every query. Is this best practice for this sort of thing?

  • 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-09T01:15:14+00:00Added an answer on June 9, 2026 at 1:15 am

    For this type of problem, I keep a current table and a history table.

    The history table has the following additional columns:

    • HistoryID
    • EffectiveDate
    • EndDate
    • VersionNumber
    • CreatedBy
    • CreatedAt

    The effective and end dates are the time span where the values are valid. The version is just incremented every time there is a change for a record. The id, CreatedAt, and CreatedBy are columns I put into almost every table in the database.

    Generally, I keep the history table up-to-date with nightly jobs, that compare the tables and then use MERGE to combine the data. An alternative is to wrap all changes in stored procedures, and to update both tables there. Another alternative is to use triggers, that detect when a change occurs. However, I shy away from triggers, preferring the first two alternatives.

    I must admit that disk space is not a big consideration for these tables. So, there is no problem storing the data twice, once in the results once in the history. It would be just a minor tweak to store only history in the history table, with the current records in the “current” table.

    One downside to this approach is changing the structure of the base table. If you want to add a column, you need to add it to the history table as well as the base table.

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

Sidebar

Related Questions

i will need to store 3 tables of data instead of implementing an entire
I would like to completely empty the entire database, restoring it to the way
Can SQL Server or db2 do entire database exports like oracle (using exp command)?
Is any thing wrong if i create alter script on the entire database in
I'd like to encrypt basically the entire database for my rails application (or at
I would like to do a find and replace inside an entire database not
If I have database A, and database B. Database B has existing data... Database
What's the correct way to copy entire database (its structure and data) to a
Redis is a NOSQL key/value database, which reads the entire life within RAM (and
It has been requested of me to dump an entire database hosted on MS

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.