What Happens When Your Database Reaches 1 TB?

How a growing events platform like Matoo helps us understand database limits, performance challenges, and the need to plan for scale.

It Starts with a Simple Question

Picture a Saturday morning, when thousands of people across Europe open Matoo, discover local events, and make plans for the weekend. Behind every event listing, every RSVP, and every attendee check-in, another small piece of information quietly enters the database. Now imagine Matoo growing for several years, collecting millions of records along the way, until one day the database dashboard displays a rather intimidating number: 1 TB. Someone notices that the primary key uses BIGINT(20), another developer wonders whether the IDs might eventually run out, and suddenly the team has an interesting problem to investigate.

Understanding BIGINT(20): Are We Running Out of Numbers?

At first glance, BIGINT(20) sounds like a number with a strict limit, but that is not actually how it works in
 . The 20 refers to a historical display-width setting, not the number of records a table can contain, and the underlying integer still occupies eight bytes. A signed BIGINT supports positive values up to 9,223,372,036,854,775,807, or about 9.2 quintillion, making it incredibly difficult to exhaust through ordinary application activity. Even if Matoo somehow generated one million new IDs every second, it would take approximately 292 thousand years to exhaust that range, assuming the sequence started at zero.

For PostgreSQL, including databases provided through Supabase, the equivalent data type is simply BIGINT, without the MySQL-style (20) notation.

What Does 1 TB Actually Mean?

A primary key identifies a record, while database storage measures the space occupied by all those records, their indexes, and other internal structures. Imagine that Matoo stores event listings, RSVP records, check-in histories, and activity logs for communities across Europe. If each activity record averaged about one kilobyte, a terabyte could hold roughly one billion records, though the actual total would depend on the data and storage overhead. That's a tremendous amount of information, but it is still nowhere near exhausting a signed BIGINT, and modern relational databases can operate well beyond a single terabyte.

For perspective, MySQL's InnoDB storage engine has an internal tablespace limit of 64 TiB with its default 16 KB page size, although filesystem and infrastructure limits may be smaller.

The Real Challenge: Indexes and Performance

The bigger concern is not necessarily how many records Matoo can store, but how quickly the application can find the information users need, especially as the database continues growing. Indexes work like the index at the back of a book, letting the database find relevant information without reading everything, but they also consume extra storage. Imagine someone searching for upcoming running events in Luxembourg, checking which friends are attending, and filtering results by date or location. Without appropriate indexes, these seemingly simple operations could become increasingly expensive, particularly when tables contain hundreds of millions of records.

Another important consideration is that MySQL's InnoDB engine includes primary key values in secondary index entries, so additional indexes can consume far more storage than expected. In other words, a database containing 1 TB of information might require substantially more disk space, once indexes and other overhead are included.

How Would We Prepare Matoo for This?

Rather than immediately introducing complex infrastructure, I would approach this gradually, starting by understanding how the database is actually used. The objective would be to keep frequently accessed information available, prevent unnecessary storage growth, and make sure the platform remains responsive as more people join. For an events platform like Matoo, several practical strategies are worth considering, depending on which parts of the system are growing fastest.

  1. Optimize indexes: Identify slow queries, remove redundant indexes, and create indexes that match real application searches.
  2. Archive historical data: Move older activity records into separate storage when they are no longer needed for everyday operations, while keeping important historical information accessible.
  3. Partition large tables: Divide suitable tables by date or another useful key, allowing queries to focus on relevant partitions, rather than scanning unnecessary data.
  4. Introduce read replicas: Distribute read-heavy workloads across additional database servers, reducing pressure on the primary database, while keeping writes centralized.
  5. Consider sharding when necessary: Split data across multiple databases once a single database can no longer comfortably support the workload, accepting that this introduces additional operational complexity.

Not every application needs these techniques immediately, and introducing them too early could make development significantly harder without providing any meaningful benefit. Partitioning also requires careful planning, because the database must exclude irrelevant partitions, and some table designs or constraints may make it unsuitable.

Conclusion: Bigger Databases, Bigger Questions

The interesting thing about database scalability is that reaching 1 TB isn't necessarily a problem, but it can signal that our original assumptions deserve another look. For Matoo, the goal isn't simply storing billions of records, but making sure people can keep discovering events and connecting with communities without noticing the complexity underneath. A BIGINT might provide enough identifiers for an almost unimaginable amount of growth, yet thoughtful database design determines whether that growth remains fast, affordable, and manageable. And as platforms collect increasingly large amounts of information, perhaps the bigger question isn't how much data our databases can hold: but how much of that data we actually need to keep?

#HappyCoding

References and Further Reading

  1. MySQL 8.4 — Integer Types and BIGINT
  2. MySQL 8.4 — Numeric Type Attributes and Display Width
  3. MySQL 8.4 — InnoDB Storage Limits
  4. MySQL 8.4 — Clustered and Secondary Indexes
  5. PostgreSQL — Numeric Types
  6. PostgreSQL — Table Partitioning
  7. PostgreSQL — Database Limits
  8. Supabase — PostgreSQL Database Overview