el vis
el vis

Reputation: 1302

Holding historical data of database

I'm creating asp.net page which connects to DB and shows some information.

In my DB I have Component table, every Component has integer Value. I would like store historical records of Component.Value and then build some charts of that.

What is best method:
- create some archival tables in DB
- holding data in ComponentName.xml files like:

<date>
    <value></value>
</date>

Upvotes: 1

Views: 170

Answers (2)

Yaroslav
Yaroslav

Reputation: 6554

The xml file will grow enormously in a small period of time, for sure. Unless we are talking about very few table updates per day or alike.

RDBSM are meant to store and query data so using them should be the correct way to go. In case you are using MS SQL Serve, you can rely on Change Data Capture mechanims to accomplish the task.

Or either just create your own table where to store all the changes, use triggers to capture all the CRUD operations and then use that data for whatever you need.

Upvotes: 1

Darren
Darren

Reputation: 70814

Make a new table in your database called ArchivedComponents or ComponentHistory.

The table structure could look something like:

  • New Archived ID (Integer Primary Key),
  • The old Component ID (Integer Foreign Key that References Component),
  • Value (The value of the old component)

You could then get the graph information based upon this table.

Upvotes: 0

Related Questions