Database Design tagged posts

Recap for Concurrency: Tracking Database Changes

We talked how to track database changes with one auditing table last month. If we want to replicate these changes into another database, then we might use multi-threading to gain the high performance in data ingestion. However, based on our previous design, we track changes to column level, which generates a serious concurrency control issue. Let’s think about, we have a data table, with 10 columns updates at once, then all these changes are captured and inserted into my_audit_table. If at the same time, another table gets updated, then there might have some cross inserting in my_audit_table, which makes the multi-threading read even harder.

Is there a better approach that we should go? In this case, it’s worth to re-design the audit_table. Let’s see how it looks like (in Oracle PL/SQL):

c...
Read More

Tracking Database Changes with One Auditing Table

Often we need track changes for the entire database, so we need design audit system to track changes. There are many best practices, such as separating the auditing table in another database, keep it small and fast, demoralize, etc. But at the end, we are facing how to design the auditing system.

There are a few approaches to design the auditing system:

  • Build an auditing table for each base table;
  • Build one generic auditing table to track changes of all database tables;
  • Write changes to XML files which are stored outside of the database.

Triggers residing on database tables may capture changes and write to auditing table(s) or XML files. There are cons and pros for each one of them. None of them is perfect...

Read More

Building a Database-driven Application Framework

Normally, people use database as data store, which contains all data tables and lookup tables. The front end application reads the data, presents them to user. If we get another similar request, we simply build another application, which handles another similar database schema. If we get a dozen clients, it’s going to be hard to maintain them all.dbdriven

Many application vendors are struggling to manage the variety of clients’ requirements, while providing similar functional modules to different clients. How do we handle all these changes easily on a common front-end code base? There are many answers, you might say that we may encapsulate the modules, inherit them and expand them. It’s a valid answer...

Read More