Last month, I wrote an explainer on AI and it was well-received, so here is one on data lakes. If you already know the concepts, you may still find this framing helpful in client discussions. Our audience this time is the CFO, or maybe the CMO, and our motivation is that their analytical needs are not well-served by the transactional database.
Transactional Processing with a Relational Database
The data that runs your business – most of it, anyway – is probably stored in a relational database like Microsoft’s venerable SQL Server. Without going into details about the “relational” structure, the key is that this database is optimized for the daily operations of the business.
New policies are booked, premiums collected, and claims paid. These are transactions that add, change, or delete records. There are also “read only” operations, like producing invoices, but the database is designed primarily for transaction processing.
A well-designed transactional database will resist anomalies
A well-designed transactional database will resist anomalies, like a line item with no invoice, or two sales of the same item. The database designer will have used a technique called normalization, breaking the data up into smallish tables with relationships that enforce integrity.
Think of how your chart of accounts is organized. Everything you need to account for is broken down to the lowest relevant level, and then rolled up for reporting. Every journal entry hits two accounts, debit and credit, so that they’re kept in balance. Your meticulously normalized database is kind of like that.
When a customer places an order, a row is added to the Order table. You don’t need to open the Customer table unless there’s a change to the customer. Built around these normalized tables is the machinery of indexes, clusters, and triggers, which support speed and integrity.
Pro Tip: Take time to confirm that the transactional database is stable and supporting the business satisfactorily. You don’t want to start building pipelines and then discover there’s a problem with your data source.
Analytical Processing with a Data Warehouse
Transaction processing involves adding and changing data, with carefully limited scope. Analytical processing, by contrast, is mostly reading data – not changing it – and holistic in scope. To support this, the data must be copied into a separate database and denormalized.
Let’s say you want to know whether Dent protection sells better as a standalone product, or as part of a bundle – corrected for the number of dealers who don’t offer the bundle, and segmented by the vehicle’s make and price range.
You could run this query against the transactional database, but it would be difficult. The query is complicated enough without having to piece together data from multiple tables. The normalization which served so well for transaction processing is now an obstacle.
Confession: I am a normalization bigot. I bought C.J. Date’s textbook, read the original papers in the ACM journal, and even coded Bernstein’s algorithm. To me, organized data is normalized data, and de-normalizing is like leaving your clothes on the floor.
So, this is a good guide to denormalization. Everything we learned not to do in relational databases – wide tables, nested data, repeating groups – is useful here.
Analytical data is stored in cubes, stars, snowflakes, hearts, and clovers
Analytical work requires not only a new database design, but a new database system. Out goes SQL Server and now we have Big Query, Redshift, and Snowflake. You may hear this buzzword, OLAP, which means “online analytical processing.” This concept was invented for marketing purposes, to describe the new category of software.
Analytical data is stored in cubes, stars, snowflakes, hearts, and clovers (see sidebar). Just kidding about the hearts and clovers. Also, while your transactional database may be running SQL Server “on premise,” the analytical database will almost certainly be on a cloud service from Amazon, Microsoft, or Google.
To be honest, not everyone needs an OLAP database. As CIO for BMW Financial Services, I did not recommend one because our analytical workload was small, at the time, and could be served adequately without a lot of new gear and expensive consultants. Since then, I have gone over to the side of the consultants.
Sidebar: What’s an OLAP Cube?
In the early days of analytical processing, software vendors thought it would be a good idea to use a multidimensional data structure called a hypercube. Think of a typical spreadsheet, with rows representing an income statement and one column for each month. That’s two dimensions. Now, add a stack of spreadsheets, one for each region. That makes three dimensions, like a cube. I put myself through grad school working at Comshare, one of the first OLAP software vendors. It supported seven dimensions. That’s a hypercube. Nowadays, there are better data structures, and this leads to some confusion. Older analysts may assume that if they’re doing OLAP, then they must be using a cube. They may use the term “OLAP cube” to mean any analytical database, even though cubes have largely been replaced by newer structures.
Pooling Data in a Data Lake
You can think of the data lake as a way station between the transactional database and the data warehouse. We want to collect all the data into a common repository before loading it into the data warehouse.
Why not simply extract, transform, and load data straight from the transactional database? Well, we could, but it would be brittle. Any change on either side would require an update to the pipeline. The data lake decouples the OLTP and OLAP data stores.
The data lake serves the very important function of storing all the data, in whatever format, whether or not it’s amenable to organization. The term’s originator, James Dixon, wanted to suggest a large volume of data with no preconceived organization.
The key thing is to collect all the data in one place, and think about organization later. This calls for an “object data store,” like Google Cloud Storage. GCP and AWS both use “buckets.” You get the idea – this is where you leave your clothes on the floor.
Most of your data will indeed be structured data coming from the transactional database, and on its way into the OLAP database – but not all of it. Here are some real-life examples I have encountered:
- Logs of API traffic. Details of who is using our ecommerce API, including copies of the payload for each request and response.
- Text snippets. A file of the several paragraphs that make our standard Texas contract different from the one in Wisconsin, so that we can produce new contracts automatically. Same goes for product copy on the web site.
- Telephone metadata. A list of timestamps, durations, phone numbers, and extensions for all calls in the call center, both inbound and outbound.
These examples are better served by special-purpose databases like Hadoop, Bigtable, and Mongo. It’s best to take stock of all the data your analysts might need, broadly speaking, and start collecting it before you go too far with designing the OLAP database.