I'm building a Twitter application that grabs a users entire following and gets their specific id Ex: 1223455
I also have a huge database full of rows that contain a specific Twitter id... Look at the examples in rows...
|1| 122345 |
|2| 2232144 |
|3| 99653222 |
|4| 123232 |
|5| 2321323 |
|6| 3121322 |
The problem is we all know that Twitter is all about more and more followers (1,000's), and I was wonder is this is a good MySQL query to run potentially up to 20 times in one script run...
SELECT * FROM table WHERE twitterID='132323' OR twitterId='23123' OR twitterId='23123' OR twitterId='23123' OR twitterId='23123' OR twitterId='23123' OR twitterId='23123' OR twitterId='23123
And on and on and on and on... There could potentially be over 1,000 OR statements in a single query (and a similar query like this could be called 20 times)
This doesn't seem like a very good programming practice, but I haven't heard of another way...??
Can MySQL handle 100 million records? Yeah, it can handle billions of records. If you properly index tables, they fit in memory and your queries are written properly then it shouldn't be an issue.
The largest table we had was literally over a billion rows. This was using MySQL 5.0, so it's possible that things may have improved. It worked. MySQL processed the data correctly most of the time.
Millions of rows is fine, tens of millions of rows is fine - provided you've got an even remotely decent server, i.e. a few Gbs of RAM, plenty disk space. You will need to learn about indexes for fast retrieval, but in terms of MySQL being able to handle it, no problem. Save this answer. Show activity on this post.
The internal representation of a MySQL table has a maximum row size limit of 65,535 bytes, even if the storage engine is capable of supporting larger rows. BLOB and TEXT columns only contribute 9 to 12 bytes toward the row size limit because their contents are stored separately from the rest of the row.
This is a very bad idea indeed. MySQL doesn't do a good job with optimizing OR statements.
You'd be far better off using a JOIN or something like this
WHERE twitterId IN (
select *
from followers
where followee = whatever
)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With