SELECTing SELECT statements for Wordpress MU blogging statistics
Sometimes I miss the coding I did last century. Today I was reminded of some of the fun, when I had set my mind to doing some statistics on my blogging.
In a blog entry on http://blogs.arno.fi/isit/2009/05/14/home-made-blog-statistics-from-wordpress-mu/ I describe what I did.
The blog entry may be of interest for those who use WordPress and are set back by the huge amounts of tables it generates. I happen to host 18 blogs and with each blog requiring 8 tables, that’s a total of 144 tables. Add the 9 top-level blogs and I’ve got 153 tables to navigate.
The blog entry I wrote
- identifies the key fields
- shows how to do stats on individual blogs
- creates a statistics table into which I aggregate relevant entries from individual blog tables
- uses SELECT to generate SELECT statements
- and ends up with some statistics on the 253 blog entries in my WordPress.
I also studied the wp_n_comments tables, and came to the conclusion that I’ll need to use some global DELETEs to clean up spam comments that have found their way to my site.
I found out that, strangely enough, I haven’t approved a single comment that includes the character string “viagra”
select comment_approved,count(*) from wp_4_comments where comment_content like "%viagra%" group by comment_approved;
The same applies to “cialis“.
So I issued
delete from wp_4_comments where comment_content like "%cialis%";delete from wp_4_comments where comment_content like "%viagra%";
but I still have quite a bit of cleaning up to do, since despite deleting first 759 cialis entries and then 411 viagra entries, I still have 3683 unapproved comments to clean up (and I suspect there are less than 10 real comments that have slipped my attention in my inbox, when I’ve got notification of them).
At any rate, I got my statistics and had more efficient and fun (albeit incomplete) spam cleaning than ever before!



Unlike Dopplr, starting with Picasa Web never required invitations. My first exposure to Picasa was through MySQL colleague
Like for all social networking sites, I obviously had to register. This wasn’t hard, and it was part of my general Google profile (Google Reader, Google Mail etc.). The real obstacle which had kept me from doing it earlier was installing the picture uploader, called “Picasa Web Albums Uploader“. I’m not a person who likes to tweak with the technical setup of my computers, hence the reluctance. But it was OK. I didn’t have to know anything in advance; the Picasa web site gave the relevant pointers and I wasn’t lead astray during the installation.
The next step is completely optional, but very “cool” and inspiring: I can tag the pictures, and I can place them on Google Maps.
Placing the picture on the map can be everything from dead easy to very frustrating. For my pictures from Munich, I very simply typed in the address: just “Balanstr. 22″ for 