Right now I'm working on an app that works with tweets. I want to find all tweets that link to iTunes.
When I was using:
> select * from `tweets` where `url` not like '%twitter.com%' and `url` like '%itunes.apple.com%'
I could scale my server up to 16 CPUs, it would still take several minutes to search a few million tweets.
Yesterday I added another field to the database, `is_audio_url` where I pre-compute whether the URL is an itunes link (by string matching in the app code) when I insert the record into the database. So I can do:
> select * from `tweets` where `is_audio_url` = 1
And now it's blazing fast. It is just my most recent of many experiences that MySQL really struggles with text matching.