انتقل إلى المحتوى
لندن، المملكة المتحدة · تأسست عام 1994
العربية

Unit 2: Storing Data at Scale

How very large datasets are stored across many machines, the main families of databases, and the differences between data warehouses, data lakes and lakehouses.

Unit 2 of 5 · about 54 minutes

2.1 Distributed storage

A single computer has limits: its disks can hold only so much, and if it fails, everything on it may become unavailable. Big data systems overcome these limits by spreading data across many computers that work together, an approach called distributed storage. Understanding the basic ideas helps you make sense of the technology choices that data teams discuss.

Scaling up and scaling out

There are two ways to handle more data. Scaling up, also called vertical scaling, means buying a bigger, more powerful machine. It is simple but becomes very expensive, and there is always a ceiling. Scaling out, or horizontal scaling, means adding more ordinary machines and sharing the work between them. Most big data systems scale out, because it allows capacity to grow step by step and avoids depending on a single expensive server.

How distributed storage works

In a distributed storage system, large files are split into smaller pieces, often called blocks or chunks, which are stored on different machines in a group known as a cluster. A coordinating service keeps track of where each piece lives. When a program needs the file, the pieces are read in parallel from several machines, which can be much faster than reading from one disk.

To protect against failure, each piece is usually stored more than once on different machines, a technique called replication. If one machine fails, which is normal in large clusters, copies on other machines keep the data available and the system creates new copies automatically. Some systems use more space-efficient methods that rebuild lost pieces mathematically from the remaining data.

Distributed file systems and object storage

The Hadoop Distributed File System, usually called HDFS, was an influential open-source distributed file system that helped popularise big data processing on clusters of ordinary servers. Many organisations still run it, but much new big data work now uses cloud object storage. Object storage holds data as objects, each consisting of the data itself, descriptive metadata and a unique identifier. It is offered by all major cloud providers, can grow almost without limit, is relatively inexpensive and is designed to be highly durable.

The two approaches differ in several practical ways:

  • Who runs it. A distributed file system on your own cluster is run by the organisation or a partner; cloud object storage is run by the cloud provider.
  • Scaling. An own cluster grows by adding more servers; object storage grows automatically as you store more.
  • Cost model. An own cluster involves upfront spending on hardware and staff; object storage is paid for according to what you store and access.
  • Storage and computing. On an own cluster these often share the same machines; with object storage they are separate, so each can scale independently.

The separation of storage from computing is an important modern idea. It means an organisation can keep large amounts of data cheaply and pay for processing power only when it runs an analysis.

Tip: When comparing storage options, ask not only what it costs to store data but also what it costs to read, move and process it. Charges for retrieving data or moving it out of a cloud provider can be significant.

File formats matter

How data is laid out in files affects speed and cost. Traditional formats such as CSV store data row by row in plain text, which is easy to read but slow to analyse at scale. Columnar formats, such as Parquet, store values for each column together and compress them efficiently. Because many analytical questions use only a few columns, such as total sales by region, columnar formats allow systems to read far less data, which saves time and money.

Storage tiers

Not all data needs to be instantly available. Cloud providers and storage systems offer tiers: fast, more expensive storage for frequently used data, and slower, cheaper archive storage for data kept mainly for compliance or occasional historical analysis. A sensible policy moves data between tiers automatically as it ages.

In practice

When your organisation discusses where to store a large dataset, ask five questions. How much data is there now, and how fast is it growing? How often will it be read, and by whom? What would happen if it were unavailable for an hour or a day? How long must it be kept, and are there legal requirements about where it is stored? What are the full costs, including reading and moving data? These questions apply whether the answer is an on-premises cluster or a cloud service, and they help non-specialists contribute meaningfully to technical decisions.

2.2 Databases for big data

Storage holds the data; databases organise it so that it can be found, updated and queried efficiently. For decades, the relational database was the default choice for business data. The growth of big data brought new kinds of database designed for different needs. Knowing the main families helps you understand why organisations often use several databases side by side.

Relational databases

Relational databases store data in tables made of rows and columns, with relationships between tables defined by keys. A customer table might link to an orders table through a customer number. Data is queried using SQL, the Structured Query Language, which remains one of the most valuable skills in data work. Relational databases enforce a defined structure, called a schema, and offer strong guarantees that transactions are processed reliably. These guarantees are often summarised as ACID: atomicity, consistency, isolation and durability. They are why relational databases are trusted for banking, orders and other systems where every record must be correct.

Traditional relational databases were designed to run on a single server, which can limit their scale. Many modern relational and SQL-based systems now distribute data across many machines while keeping familiar SQL.

NoSQL databases

The term NoSQL, often read as "not only SQL", covers several database families designed for flexibility, scale or particular data shapes:

  • Key-value stores save data as simple pairs of a key and a value, like a very fast dictionary. They suit session data, caching and shopping baskets.
  • Document databases store records as flexible documents, often in JSON, so that different records can have different fields. They suit product catalogues and content management.
  • Wide-column stores organise data into flexible columns spread across many machines, and handle very high volumes of writes, such as sensor readings or activity logs.
  • Graph databases store entities and the relationships between them, which suits questions about networks, such as fraud rings, supply chains or social connections.

Trade-offs in distributed databases

When a database is spread across many machines, it faces a fundamental tension. If the network between machines fails, the system must choose between staying available, possibly returning slightly out-of-date data, and staying strictly consistent, possibly refusing some requests until the problem is resolved. This trade-off is often discussed under the name of the CAP theorem. Many NoSQL systems favour availability and accept eventual consistency, meaning all copies will agree after a short delay. That is acceptable for a social media like count but not for a bank balance.

Remember: There is no best database, only a database that fits a particular pattern of use. Ask what the data looks like, how it will be queried and how much consistency matters.

Operational and analytical workloads

It helps to separate two kinds of work. Operational or transactional workloads handle many small reads and writes as business happens: recording an order, updating an address. Analytical workloads read large amounts of data to answer questions: total sales by region over five years. Running heavy analysis on an operational database can slow down the systems that customers and staff depend on. This is why organisations usually copy data from operational systems into separate analytical systems, which are the subject of the next lesson.

Choosing a database

Questions that guide the choice include:

  1. What shape is the data: tables, documents, events or networks of relationships?
  2. Is the main workload operational, analytical or both?
  3. How important is strict consistency compared with speed and availability?
  4. How large will the data become, and how fast will it arrive?
  5. What skills does the team already have, and what support is available?

Using many specialised databases can be powerful but also increases complexity, cost and the number of skills required, so organisations benefit from a deliberate rather than accidental mix.

In practice

Think about the systems in your organisation. Which ones record transactions as they happen, and which are used for reporting and analysis? If reports run slowly or slow down everyday systems, that may indicate that operational and analytical workloads are not well separated. When a team proposes a new database, ask how it fits with existing systems, who will maintain it and how its data will be combined with other sources. Those questions often matter more than the technical features of the database itself.

2.3 Data warehouses, data lakes and lakehouses

Most organisations want a single place where data from many systems can be brought together for analysis. Three main approaches have emerged: the data warehouse, the data lake and, more recently, the lakehouse. Each reflects a different balance between structure, flexibility and cost.

Data warehouses

A data warehouse is a central store of cleaned, integrated and structured data designed for reporting and analysis. Data is copied from operational systems, transformed into consistent formats and organised into tables that make common questions easy and fast to answer. Warehouses typically follow a schema-on-write approach: the structure is defined before data is loaded, and data that does not fit is corrected or rejected.

A common design organises data into fact tables, which hold measurable events such as sales, and dimension tables, which describe the context, such as products, stores, customers and dates. This arrangement, often called a star schema, makes it simple to slice results by any dimension, such as sales by product category by month.

Warehouses are reliable, fast for business intelligence and trusted for official reporting. Their limitations are that preparing data takes effort, changes to structure can be slow, and they are less suited to unstructured data such as images or free text.

Data lakes

A data lake is a large store, usually built on distributed or cloud object storage, that holds data in its raw form, whether structured, semi-structured or unstructured. Lakes follow a schema-on-read approach: data is stored first, and structure is applied when someone reads it for a particular purpose. This makes lakes flexible and inexpensive, and suits data science work that needs raw or varied data.

The risk is that, without discipline, a lake fills with poorly documented, duplicated and untrustworthy data that nobody can confidently use. This is often called a data swamp. Avoiding it requires catalogues, ownership, quality checks and access controls.

Lakehouses

A lakehouse combines elements of both. Data is kept in open file formats on low-cost object storage, as in a lake, but an additional layer adds warehouse-like features: defined tables, reliable updates, version history and fast SQL queries. The aim is to support both business reporting and data science from one copy of the data, reducing duplication. Several open table formats and commercial platforms now support this approach.

ApproachData storedStructure appliedStrengthsWatch out for
WarehouseCleaned, structuredOn writeTrusted reporting, fast queriesPreparation effort, less flexible
LakeRaw, any typeOn readFlexible, low cost, suits data scienceBecoming a data swamp
LakehouseRaw and curated in open formatsBothOne platform for many usesStill needs strong governance

Layers of refinement

Many organisations organise lakes and lakehouses into layers. A raw layer holds data exactly as received; a cleaned layer holds data that has been checked and standardised; and a curated layer holds business-ready tables for reporting. These are sometimes nicknamed bronze, silver and gold. Keeping raw data allows teams to reprocess it if a mistake is found later, while curated tables give business users a trusted starting point.

Tip: Whatever the architecture, agree on a small number of trusted, well-documented datasets for key measures such as revenue, customers and headcount. People will use the platform far more confidently if they know which numbers are official.

Data marts

A data mart is a smaller, focused subset of a warehouse or lakehouse prepared for one department or subject, such as finance or marketing. Marts make analysis simpler for their users but should draw from the central store rather than becoming separate, inconsistent copies.

In practice

When your organisation discusses a warehouse, lake or lakehouse, focus on use rather than labels. Who will use the data, for what decisions, and how much do they need to trust it? Is the data mainly structured, or does it include documents, images and logs? Who will own and document each dataset? A modest, well-governed platform that answers real questions is far more valuable than an ambitious one that becomes a swamp.

Case study: Rescuing a data lake at an insurance broker

Thornbury Insurance Partners, a fictional broker, had built a data lake three years earlier and loaded data from its policy, claims, call centre and website systems. Analysts rarely used it. They could not tell which of several customer tables was current, field meanings were undocumented and some files contained personal data that nobody had approved for analysis.

A new head of data introduced three layers. Raw data was kept as received, with access limited to engineers. A cleaned layer standardised dates, removed duplicates and masked personal details not needed for analysis. A curated layer held a small number of business-ready tables, starting with policies, claims and customers, each with a named owner from the business and documented definitions in a data catalogue.

The team converted the most used data into a columnar format, which made common queries faster and cheaper. Within six months, the underwriting team was using curated tables for monthly reporting, and old, unused files were archived to cheaper storage or deleted under an agreed retention policy.

Activity

Think of three datasets your organisation holds, such as sales records, customer emails and website logs. For each, decide whether it belongs mainly in a warehouse, a lake or a lakehouse layer, and explain why. Then name one governance step that would stop the store from becoming a data swamp.

Compare with a model answer

A good answer links each dataset to how it will be used. Sales records are structured and used for trusted financial reporting, so they suit a warehouse or the curated layer of a lakehouse, with clear definitions of measures such as revenue.

Customer emails are unstructured and might be analysed for common complaint themes, so they suit a lake or the raw layer, with strict access controls because they contain personal data. Website logs are semi-structured and high volume; they could land raw in a lake and then be summarised into curated tables of daily visits and conversions.

A strong governance step might be assigning a named owner to each dataset and recording definitions, sources and retention rules in a data catalogue, so that users know what each dataset contains and whether they can trust it.

Key takeaways

  • Big data systems usually scale out across many ordinary machines, splitting and replicating data so that it remains available when individual machines fail.
  • Cloud object storage and columnar file formats make storing and analysing large datasets cheaper and faster, especially when storage and computing are separated.
  • Relational databases offer structure and strong consistency, while NoSQL families such as key-value, document, wide-column and graph databases suit other data shapes and scales.
  • Operational and analytical workloads are best separated, so heavy analysis does not slow everyday systems.
  • Warehouses hold structured, trusted data; lakes hold raw data of any type; lakehouses combine both, and all need governance to avoid becoming a data swamp.

Unit check

Create a free account to answer the check, save your progress and receive your free certificate.

Create a free account Log in
← Unit 1 Unit 3 →
WhatsApp