I have a MySQL database and I'm trying to get trending topics (popular phrases or words) using PHP开发者_如何学运维. I've tried a few queries but nothing seems to be working for me.
You could try creating a new table with two columns: WORD and COUNT, then run some queries to split the text entries on whitespace, and insert or update the new table by either inserting a new word, or bumping the count, if it's already there. Then, you could create a trigger or scheduled job to keep the new table up to date.
The benefit of this approach, is that you'd only need to scan through the source tables once to build the word list. You could throttle the scan by limiting it to a X rows per run, and then running it on a timer.
精彩评论