MySQL Performance of one vs. many tables

276 views Asked by At

I know that MySQL usually handles tables with many rows well. However, I currently face a setting where one table will be read and written by multiple users (around 10) at the same time and it is quite possible that the table will contain 10 billion rows.

My setting is a MySQL database with an InnoDB storage engine.

I have heart of some projects where tables of that size would become less efficient and slower, also concerning indexes.

I do not like the idea of having multiple tables with exactly the same structure just to split rows. Main question: However, would this not solve the issue of having reduced performance due to such a large bunch of rows?

Additional question: What else could I do to work with such a large table? The number of rows itself is not diminishable.

1

There are 1 answers

0
AudioBubble On BEST ANSWER

I have heard of some projects where tables of that size would become less efficient and slower, also concerning indexes.

This is not typical. So long as your tables are appropriately indexed for the way you're using them, performance should remain reasonable even for extremely large tables.

(There is a very slight drop in index performance as the depth of a BTREE index increases, but this effect is practically negligible. Also, it can be mitigated by using smaller keys in your indexes, as this minimizes the depth of the tree.)

In some situations, a more appropriate solution may be partitioning your table. This internally divides your data into multiple tables, but exposes them as a single table which can be queried normally. However, partitioning places some specific requirements on how your table is indexed, and does not inherently improve query performance. It's mainly useful to allow large quantities of older data to be deleted from a table at once, by dropping older partitions from a table that's partitioned by date.