good_evening
good_evening

Reputation: 21749

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

I need to store ~50,000,000 values which contains only id (auto-increment) and varchar(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?

Upvotes: 1

Views: 272

Answers (3)

gbn
gbn

Reputation: 432271

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)

Upvotes: 7

Tobias P.
Tobias P.

Reputation: 4665

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.

Upvotes: 0

Karoly Horvath
Karoly Horvath

Reputation: 96266

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.

Upvotes: 0

Related Questions