A few weeks ago, I got a gmail chat message from a friend telling me that my favorite sports team was having a great match and that i should definitely watch the match. So I went to the sports portal to get the latest score and see what the team was doing. I found that the match was not that interesting and the scores were stagnant for some time. Thinking that it might’ve been a prank from my friend, I ignored it. To my dismay, the match score I saw was delayed by 10 minutes and the score wasn’t yet reflected in the sport’s portal. I suspect that an effective CDC implementation might have been the problem.
If we expand the CDC problem to stock markets and daily traders, the impact might be much higher.This is one of reasons we need more real-time data for various departments in companies which constantly trouble IT for more real time data. There are a lot of use-cases where batch data loads are acceptable, but to keep up with data volumes and data velocity, companies have to process more real time data. The trouble starts when people are just trying to handle the increase in volume and unfortunately miss the batch window for processing.
This is a 2 part series about change data capture detailing the different types of CDC, Use cases and the current product offerings.
Change Data capture – the old way
Earlier, it was a tedious task to capture delta changes from the database and capturing the staging data. Prior to the introduction of Change Data Capture, there were a number of ways that users could capture change data, including table differencing and change-value selection.
Table differencing is a method of copying an entire table from the source to staging database, where an older version of the table exists. It involves using the SQL MINUS operator to obtain the inserted and new versions of changed rows. This approach heavily increases the chances of network hogging.
Change-value selection is a method used in capturing data on the source database by selecting new and changed data based on a specific column. Usually the CREATED_DATE and MODIFIED_DATE columns in the tables. Changes are identified based on the values in these columns.
These are some of the common techniques involved in capturing changes to the data. These solutions have their limitations and use too much of manual resources to setup and documenting the changes.
Change Data Capture – the new way
There are 2 ways Change Data Capture can capture and publish committed change data
As each SQL DML (INSERT,UPDATE or DELETE) operation is executed in the database, we capture the changed data through triggers on the source database. In this method, change data is captured as part of the transaction modifying the source tables.
This is a non invasive procedure where we are able to take advantage of the data sent to the redo logs files. Changed data is captured after a SQL statement that performs a DML operation is committed. Change data is not captured as part of the transaction that is modifying the source table and therefore has no effect on that transaction.
In many ways the Asynchronous mode is more nonobstructive and has no bearing on the transaction database. Then you follow a publish and subscribe mechanism to handle data requests from different applications.
Advantage of using CDC over traditional data capturing techniques.
- Eliminate batch windows because the changes are captured automatically and delivered round the clock.
- Deliver data in more real-time to the business.
- In data integration, the risk of impacting existing applications is eliminated, because it’s noninvasive.
- Decrease MIPS usage on a mainframe compared to other integration techniques, which gives more headroom for growth on the same hardware.
- Average customers decrease MIPS costs by 30%.
I have worked for many companies who don’t have an enterprise wide change data capture strategy. This might seem like a small issue for many, since CDC problems are not evident immediately, but grows slowly over a period of time with the data volume and data velocity. The IT departments would be wise to recognize the needs and respond accordingly.
Part 2 in the series would cover capabilities, use cases and current product offerings for CDC.