ArticleslgStudy

computer science

Shard (database architecture)

Shard (database architecture) is a computer science topic covered in the lgStudy science library. This page brings together a partial reference excerpt, illustrations, worked examples, real-world applications and a short study plan, so you can understand Shard (database architecture) rather than just read about it. In short: A database shard, or simply a shard, is a horizontal partition of data within a database or search engine. Each shard may be held on a separate database server instance in order to spread across multiple servers.

Key takeaways

  • Shard (database architecture) belongs to computer science; place it in that map before memorising details.
  • Learn the definition first, then one example that makes the definition concrete.
  • Connect Shard (database architecture) to a quantity you can measure, compute or draw — that is where exam questions come from.
  • Reproduce the core statement of Shard (database architecture) from memory before moving on to harder problems.

Reference excerpt

A database shard, or simply a shard, is a horizontal partition of data within a database or search engine. Each shard may be held on a separate database server instance in order to spread across multiple servers. Some data in a database may remain present in all shards, while other data is stored in only one shard. In such cases, each shard acts as the single source for its subset of data.

Database architecture Horizontal partitioning is a database design principle whereby rows of a database table are held separately, rather than being split into columns (as in normalization and vertical partitioning, to varying degrees). Each partition forms part of a shard, which may in turn be located on a separate database server or in a separate physical location. There are numerous advantages to the horizontal partitioning of data. Since tables are divided and distributed into multiple servers, the total number of rows in each table in each database is reduced. This reduces index size, which generally improves search performance. A database shard can be placed on separate hardware, and multiple shards can be placed on multiple machines. This enables the distribution of a database across a large number of machines, which can significantly improve performance. In addition, if the database shard is based on some real-world segmentation of the data (e.g., European customers v. American customers) it may be possible to infer the appropriate shard membership easily and automatically, and to query only the relevant shard. In practice, sharding is complex. Although it has long been implemented through manual coding (especially where rows have an obvious grouping, as in the customer region example above), this approach is often inflexible. There is a desire to support sharding automatically, both in terms of adding code support for it, and for identifying candidates to be sharded separately. Consistent hashing is a technique used in sharding to distribute large loads across multiple smaller services and servers. Where distributed computing is used to separate load between multiple servers (either for performance or reliability reasons), a sharding approach may also be useful. In the 2010s, sharding of execution capacity, as well as the more traditional sharding of data, emerged as a potential approach to address performance and scalability challenges in blockchains. Recent academic work has proposed protocols such as Cerberus to address cross-shard atomicity by braiding consensus across multiple shards, allowing transactions to affect multiple partitions simultaneously without requiring a global lock.

Compared to horizontal partitioning Horizontal partitioning splits one or more tables by row, usually within a single instance of a schema and a database server. It may offer an advantage by reducing index size (and thus search effort), provided there is an obvious, robust, and implicit way to identify in which partition a particular row will be found, without having to first search the index; for example, the classic case of the 'CustomersEast' and 'CustomersWest' tables, where a ZIP code already indicates where a row will be found. Sharding extends this approach. It partitions the relevant table or tables in the same way, but does so across potentially multiple instances of the schema. An advantage is that the search load for the large partitioned table can be distributed across multiple servers (logical or physical), rather than only across multiple indexes on a same logical server. Splitting shards across multiple isolated instances requires more than simple horizontal partitioning. The expected gains in efficiency would be reduced if querying the database required multiple instances to be accessed just to retrieve a simple dimension table. Beyond partitioning, sharding therefore involves distributing large, partitionable tables across servers, while smaller tables are replicated in full on each server. This is also why sharding is related to a shared-nothing architecture—once sharded, each shard can reside in a separate logical schema instance, physical database server, data center, or geographic region. Sharding is intended to minimize the need for cross-shard access by partitioning data across independent shards. This makes replication across multiple servers easier (simple horizontal partitioning does not). It is also useful for worldwide distribution of applications, where communications links between data centers might otherwise become a bottleneck. There is also a requirement for some notification and replication mechanism between schema instances, so that unpartitioned tables remain as closely synchronized as the application requires. This is a complex architectural choice in sharded systems: approaches range from making these tables effectively read-only (with updates that are rare and batched), to dynamically replicated tables (at the cost of reducing some of the distribution benefits of sharding), and many options in between.

… excerpt ends here. Continue reading the full article.

Worked examples

Example 1 — a first encounter with Shard (database architecture)

Start with the simplest possible case. Write down what Shard (database architecture) claims or describes in one sentence, then invent the smallest concrete situation in which that sentence is true. In computer science, the smallest case is usually a single object, a single equation or a single measurement. Check that every symbol or term in your sentence has a meaning in that case.

Example 2 — changing one variable

Take the situation from Example 1 and change exactly one quantity: double it, halve it, or set it to zero. Predict what should happen to Shard (database architecture) before you calculate. Comparing your prediction with the result is the fastest way to find out whether you understand the idea or only the words.

Example 3 — an exam-style question

Typical questions about Shard (database architecture) ask you to (a) state it precisely, (b) apply it to given data, and (c) explain a limitation. Practise writing all three answers in under five minutes; the third part is what separates a full-mark answer from an average one.

Applications of Shard (database architecture)

In research
Shard (database architecture) appears in computer science research whenever the underlying quantities have to be modelled precisely. Papers usually cite it as a starting assumption and then explore where it breaks down.
In technology and industry
Engineering practice reuses Shard (database architecture) in design rules, simulations and safety margins. Knowing the idea lets you read a specification sheet and understand why the numbers look the way they do.
In the classroom
Shard (database architecture) is common in secondary-school and first-year university syllabi. It links to neighbouring topics Data partitioning, Database management systems, Software design patterns, so understanding it makes those chapters shorter.
In everyday life
Look for Shard (database architecture) outside the textbook — in sport, cooking, traffic, electronics or the sky above you. An example you found yourself is remembered far longer than one you were given.
Ask Teacher Smith questions about this articleOpens your AI tutor with a question about “Shard (database architecture)” →

How to study Shard (database architecture) in 20 minutes

  1. Read the reference excerpt below once, without taking notes.
  2. Close the page and write down what Shard (database architecture) means in your own words.
  3. Compare your version with the excerpt and mark what you missed.
  4. Work through the three examples above with pen and paper.
  5. Explain Shard (database architecture) out loud to somebody else — or to Teacher Smith in the lgStudy chat.

Frequently asked questions

What is Shard (database architecture) in simple terms?

A database shard, or simply a shard, is a horizontal partition of data within a database or search engine. Each shard may be held on a separate database server instance in order to spread across multiple servers.

Why does Shard (database architecture) matter?

Because it connects several computer science ideas at once: it gives you a definition you can apply, a quantity you can calculate, and a way to check whether a result is plausible.

How should I study Shard (database architecture)?

Read the excerpt, restate it from memory, then work through the examples and applications listed on this page. The five-step study plan above takes about twenty minutes.

What does this page cover?

It gives you a compact reference excerpt plus original lgStudy explanations, examples, applications and study material on Shard (database architecture).

Tags

  • Data partitioning
  • Database management systems
  • Software design patterns

Keep exploring