What Database Does Facebook (Meta) Use?

Meta runs sharded MySQL as the system of record for the social graph. RocksDB is the storage engine, and a cache layer called TAO sits in front. The social graph is the store of users, posts, comments, and the links between them.

So yes, Facebook uses MySQL. It is not one large MySQL server. It is thousands of small shards, each holding one slice of the data.

No single database serves the whole company. Meta runs different stores for different jobs, and most of them are built in house.

The Main Stores and What They Do

SystemTypeWhat it holds
MySQL with RocksDBRelational, shardedThe social graph, the durable copy of the data
TAODistributed cache for graph dataReads of users, posts, likes, and their links
memcachedIn memory cacheSmall hot values in front of MySQL
ZippyDBKey value store on RocksDBConfiguration, counters, general key value needs
Hive warehouse with PrestoAnalyticsLogs and events for reporting and data science
Haystack and f4Blob storagePhotos and video files
ScubaIn memory analyticsShort lived operational data for debugging

Why MySQL and Not Something Newer

Meta kept MySQL and changed what sits under it. MySQL lets you swap the storage engine, which is the part that writes bytes to disk.

Meta replaced the default engine with MyRocks, which is built on RocksDB. RocksDB is a key value store Meta wrote and released as open source. It uses a log structured design, which writes data in sorted batches instead of updating pages in place.

The reported gain was space. Candidates and public talks describe roughly half the storage of the previous engine for the same data. Less storage means fewer servers.

What TAO Does

A social graph read is small and very frequent. Loading one profile can need hundreds of tiny lookups.

TAO sits between the application and MySQL and answers those lookups from memory. It understands the graph model directly, so it stores objects and the links between them.

Writes go through TAO to MySQL. Reads almost never touch MySQL. In a system design interview, this is the pattern to name: a purpose built cache tier over a sharded relational store.

Two Common Mistakes About Facebook's Databases

The first mistake is saying Cassandra runs Messenger. Cassandra was created at Facebook and open sourced from there, which is why the claim spreads. Messenger did not stay on it. Messenger storage moved to HBase and later onto the RocksDB based stack.

The second mistake is saying HBase holds the social graph. The graph lives in MySQL behind TAO. HBase was used for messages and for time series style operational data, not for the graph.

How the Pieces Fit Together

Think of it as four layers.

  • Caches. memcached and TAO answer most reads.
  • System of record. Sharded MySQL with MyRocks keeps the durable copy.
  • Special purpose stores. ZippyDB for key value data, Haystack and f4 for media files.
  • Analytics. Events land in the warehouse, and Presto queries it.

Files are the part people forget. Photos and videos never go in the database. Only the metadata and a storage key do.

Why Interviewers Ask This

The question tests whether you know that scale changes design, not technology choice. A relational database is still correct at this size, once you shard it and cache it properly.

If you get this question, answer in three parts. Name MySQL as the system of record. Name the cache tier. Then say that blobs and analytics live somewhere else entirely.

How to Prepare

TAGS
System Design Interview
Coding Interview
CONTRIBUTOR
Arslan Ahmad
Arslan Ahmad
ex-FAANG engineering manager and author or Grokking series.

GET YOUR FREE

Coding Questions Catalog

Design Gurus Newsletter - Latest from our Blog
Boost your coding skills with our essential coding questions catalog.
Take a step towards a better tech career now!
Explore Answers
What is the acceptance rate for Microsoft final round interviews?
What is a problem in software engineering?
What is story in agile?
What coding language is for AI?
Which course is best for coding interviews?
Which one is better, networking or programming?
Related Courses
New
Grokking the AI System Design Interview course cover
Grokking the AI System Design Interview
Learn to design AI systems the way interviewers expect: classic ML products, LLM and RAG architectures, and agentic systems, all through the lens of the system design interview.
4.6
(3,192 learners)
Discounted price for Your Region

$123

Grokking the Coding Interview: Patterns for Coding Questions course cover
Grokking the Coding Interview: Patterns for Coding Questions
The 24 essential patterns behind every coding interview question. Available in Java, Python, JavaScript, C++, C#, and Go. The most comprehensive coding interview course with 543 lessons. A smarter alternative to grinding LeetCode.
4.6
Discounted price for Your Region

$197

Grokking Modern AI Fundamentals course cover
Grokking Modern AI Fundamentals
Master the fundamentals of AI today to lead the tech revolution of tomorrow.
4.1
Discounted price for Your Region

$72

Design Gurus logo
One-Stop Portal For Tech Interviews.
Copyright © 2026 Design Gurus, LLC. All rights reserved.