Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Database design--billions of records in one table?

Tags:

database

Let's say you're creating a database to store messages for a chat room application. There's an infinite number of chat rooms (they're created at run-time on-demand), and all messages need to be stored in the database.

Would it be a mistaken to create one giant table to store messages for all chat rooms, knowing that there could eventually be billions of records in that one table?

Would it be more prudent to dynamically create a table for each room created, and store that room's messages only in that table?

like image 929
core Avatar asked Jul 17 '09 21:07

core


People also ask

Which database is best for billions of records?

Oracle has provided high-quality database solutions since the 1970s. The most recent version of Oracle Database was designed to integrate with cloud-based systems, and it allows you to manage massive databases with billions of records.

Can MySQL handle 1 billion records?

Can MySQL handle 1 billion records? Can MySQL handle 100 million records? Yeah, it can handle billions of records. If you properly index tables, they fit in memory and your queries are written properly then it shouldn't be an issue.

Can SQL handle billions of rows?

They are quite good at handling record counts in the billions, as long as you index and normalize the data properly, run the database on powerful hardware (especially SSDs if you can afford them), and partition across 2 or 3 or 5 physical disks if necessary.

Which database is best for large amount of data?

MongoDB is suitable for hierarchical data storage and is almost 100 times faster than Relational Database Management System (RDBMS).


1 Answers

It would be proper to have a single table. When you have n tables which grows by application usage, you're describing using the database itself as a table of tables, which is not how an RDBMS is designed to work. Billions of records in a single table is trivial on a modern database. At that level, your only performance concerns are good indexes and how you do joins.

like image 176
Rex M Avatar answered Sep 20 '22 09:09

Rex M