Hi and I have been working on a project involving a rather large database. My question is "For a database with over 20529860 rows, is it better to have 3330 tables spreaded equally or to split into multiple databases or would it be better to have 49950 tables in the database containing the information?" The reason I ask is that having all those rows in the one table makes it really slow with the Where clause and I'm not sure which way is the best way to design this database with mysql. I found that anything over 15MB in one table takes too long to lookup so if I had to guess I would spread it over the 49950 tables ((255-33)*15*15) but sounds like a ridiculous number of tables to store the one set of data. So does anybody have any ideas on how to store potentially 1,000,000,000 rows in mysql. Each row only contains a few bytes. Thanks.
Recommended Answers
Jump to PostI found that anything over 15MB in one table takes too long to lookup
I never faced any problem with much larger tables (in GBs).
Are you properly indexing your tables? For performance, you can split the tables on year/month basis if you have datatime field. Otherwise you can …
Jump to PostI am dealing with tables with 50+ million rows with much more columns. But they do not contain more than 1 text column. Are columns of type text or varchar?
The performance also depends on the available RAM to MySQL. I have quad core server with 12GB RAM.
…
Jump to PostCreating a table with VARCHAR columns of a specified length is very easy. e.g
CREATE TABLE `table_data` ( `col1` VARCHAR( 150 ) NOT NULL , `col2` VARCHAR( 150 ) NOT NULL , `col3` VARCHAR( 150 ) NOT NULL , `col4` VARCHAR( 150 ) NOT NULL ) ENGINE …
Jump to PostYes, 150 is the maximum string length that can be strored in this column. This can be any value upto 255 for VARCHAR. You can not manually set the length for each row, MySQL adjust it automatically for VARCHAR. Read the details in
All 16 Replies
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.