Background: MySQL 5.7, InnoDB Engine
We have a huge transaction log table (6 million new rows per day) and we want to shard this huge table into multiple mysql instances and tables (so we have table_001, table_002, etc). Users often query their recent rows which means recent rows are hot while old rows are cold.
I'm wondering if mysql partitions are still needed in each sharded table (table_001, table_002, etc) in this case. My opinion is NO. If we already sharded the data into many sub-tables, why we need another kind of sub-tables by using partitions? (Partitions are actually separate tables internally right?)
There are 4 ways to split up a table:
table_001
, etc -- Again and again, this is suggested on this forum. It is always shot down as a bad idea.Will you be removing "old" data? If so, PARTITION BY RANGE(TO_DAYS(..))
makes purging much more efficient. But it does not necessarily improve SELECT
performance; let's see your SELECTs
.
Will you be "summarizing" the data, a la Data Warehousing "reports"? If so, we can discuss this further.
re: INSERTion rate
With InnoDB, a single big table is essentially as easy to INSERT
into as multiple small tables or multiple partitions. 200 is not a very big insertion rate.
INSERT ... VALUES (...), (...), ...;
? Or use LOAD DATA
? Either of those is likely to sustain over 1000/sec.INDEXes
? They are somewhat a burden on high insertion rate. Let's see SHOW CREATE TABLE
so we can discuss further.INSERTs
?