开发者

What is the best database to store ~50,000,000 values?

开发者 https://www.devze.com 2023-03-24 08:23 出处:网络
I need to store ~50,000,000 values which contains only id (auto-increment) and varch开发者_StackOverflowar(32). And then show the random value for each pageload. Of course I wouldn\'t use RAND().

I need to store ~50,000,000 values which contains only id (auto-increment) and varch开发者_StackOverflowar(32). And then show the random value for each pageload. Of course I wouldn't use RAND().

So, is MySQL good for it if I work with PHP? Or should I learn some other database which is more optimal?


50 million rows is a rounding error for the mainstream RDBMSes.

Use MySQL if you know it, or pick one you're comfortable with.

To pick one row out of 50 million, you generate a number between 1 and 50 million and pick that single row. So why not use RAND as a number generator? (Edit: but not in the ORDER BY as per redShadow's comment on question)


If you don't have a lot of queries MySQL is probably fine.

If you don't delete records and the auto-increment range is continuous a key-value store is perfect for this. However you will need something (SQL, if you are lazy :)) that gives you an atomic counter so you can insert new key-value pairs.


Think of splitting your data into several tables: if you ever have to change the schema of your table you have to rebuild a table with 50 million rows instead of say 10 tables with 5 million rows.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号