Blog Stats & SQL Question..

Posted on March 20th, 2006 by Christopher.
Categories: Announcements, Cool Tech & Web stuff, Hilarious.

Added blog stats on the left menu, takes forever to load.. like 20 seconds. (lol, we have reached the point that 20 seconds is forever).
On a second thought I’m trying to mess with the wordpress database… with SQL.. nothing fancy.. using MyAdmin (MyPHPSQL)..

I want to IF email = “whatever” insert “data” into “correct column”
Can anybody give me the correct syntax, I can pick the right tables without to much problems.. but the if thens in sql.. are a bit rusty.. and I need to get it right the first time.

27 comments.

They Call Me Meisha… »« Who the Hell are You Anyway???

Christopher the Pyro quibbed this

INSERT INTO wp_comments
(comment_author_url)
SELECT ‘www.url.com’
WHERE comment_author_email = “email@email.com”;

whatta think… (be gental..)

March 20th, 2006

Christine the Lioness scribbled

It’s soooooooo sexy when he talks like a computer geek. :*

March 20th, 2006

Haas the Addict hunt n' pecked this

I guess the Blog Stats page takes so long is coz of the size of the database. The queries I imagine you will be passing to get those details will themselves take a while to finish…
This page took 373 queries. 16.545 seconds of computer time to create.
Now you can try adding an index or two try the email column coz ur passing queries on it… Probably a BTree index if MySql supports it…
Other than that you cant do much… If you really want to speed up stuff I hv an idea but it involves a lot of work and touching Wordpress internals…

March 20th, 2006

Christopher the Pyro spake, and sayeth

Haas,
Actually we have some people who would like the URL’s of there blogs added to all their comments and also people like ben and aj have multipl names in our list I was thinking of trying to combine them.

Hit me thru the wordpress contact us, I’m interested in hearing how we could speed everything up… altho as long as we are running the polls, and the top ccommenter, latest commenter lists.. thing are only going to get so fast.. plus the database is starting to get some size to it.

March 20th, 2006

Haas the Addict remarked

Oh ok I see, I guess I was Solving the wrong problem P
Firstly MySql does not allow you to update one table using data from another table… plus u got to be making an update not an insert (hope ur doing what I think ur doing P )
This will require you to manually make the changes to the wp_comments table…
A query such as:
UPDATE wp_comments
set comment_author_url = “http://url.com”
where comment_author_email = “email@domain.com”;
PS: U will hv to do it for each one of ur commenters… Conisdering the prob is with Ben and Aj’s details it will take u just 2 queries….
VERY IMPORTANT: Dude backup ur data(I know u already knew that) coz i hv not tried the query on my sys… can test it and tell u in a while if u want.

March 20th, 2006

aJ the Zen Master up'n wrote this

#3 is correct. You only need to update not insert.
Btw sorry for the multiple meta info :\”> but it was all due to me shifting to my own domain with it’s own email address. The earlier one was shared with a few friends

March 21st, 2006

Lei the Mercenary spake, and sayeth

ah computer gods ^ ) ^

March 21st, 2006

Christopher the Pyro commented

Great advice guys.. .now..

UPDATE wp_comments
SET comment_author_email = ‘aj_new_email’
WHERE comment_author_email = ‘aj_old_email’

Do you running this query could be deadly?

March 21st, 2006

Haas the Addict up'n wrote this

Nope, I wont be really worried but create a copy of ur db (atleast that table) and run it on that first(u dont want to change the email id of everyone to aj_new_email by mistake) :-w
But just running…
SELECT * FROM wp_comments
WHERE comment_author_email = ?aj_old_email?
will tell u which tuples its changing so a bit more safer… check the output and if its only Aj’s comments… d / then go ahead ) >-

March 21st, 2006

Christopher the Pyro chimed in with

dude.. I think it’s ” not ‘ ?

March 22nd, 2006

Christopher the Pyro got all philosophical

Ahh.
Haas - AJ
Thanks for the good information the top 20 commenters now make sence.. Ben your comments are now combined under on user name! ) All is right in the blogsphere this morning.

March 22nd, 2006

aJ the Zen Master asserted

Thank Christopher.. I did not know I’d commented so much )

March 22nd, 2006

Haas the Addict up'n wrote this

One small fix dude… My blog is at “blog.chandrahasa.com” I moved to a few weeks ago so can u plz make the change in the top commenters page )
Sorry for the trouble

March 22nd, 2006

Matt the Groupie pontificated

215 queries does seem like an awful lot for a relatively straightforward page… and I was thinking to myself today how slow the site is…

March 23rd, 2006

Christopher the Pyro hunt n' pecked this

Haas Fixed )

March 23rd, 2006

Christopher the Pyro said this

Lei, I think your fixed up also..

March 23rd, 2006

Lei the Mercenary stated

Goodie! Thanks, Chris! )

March 23rd, 2006

Keith the Director commented

Didn’t I tell you to have faith in my boy lei? ) Plu sI’d say you’re fixed…You went from 8 comments to 72 over night d

March 23rd, 2006

Lei the Mercenary uttered

aight! 72 comments in less than 24 hours is not at all bad )
now my next job for christopher is…. :-? )

March 23rd, 2006

Christopher the Pyro spake, and sayeth

Lei, you will have to give me a couple days.. Christine is now loading me up with projects on CvC.. )

March 23rd, 2006

Keith the Director penned this

Lei you don’t want to gothere with chris ) …your finace’ might get mad! d

March 23rd, 2006

Lei the Mercenary quibbed this

o lol! i read it as “finance” the first time, and i thought, huh? slow me, hehe… dont worry, the job i have for him is just a change of avatar, but i can wait. no hurry… )

March 23rd, 2006

Keith the Director uttered

ohhh ok well that safe… ) you can actually change that on you own..make it yourself and register it then you can put it in under your preferences.
http://www.gravatar.com/

March 23rd, 2006

Christine the Lioness quibbed this

Thank God for Lei… now Christopher can never again say *I’m* the most demanding woman he’s ever met… -)

March 23rd, 2006

Christopher the Pyro chimed in with

Lei,
Have you checked out http://www.gravatar.com if you have one of those.. I THINK it will overridge your avatar here.. and it will work everywhere on the internet.. but if not drop me an email at Christopher@chrisvschris.com with the avatar u were interested in.. altho be warned I am thinking about changing that system due to the slowness of the site.

March 23rd, 2006

Lei the Mercenary asserted

Hehe, Christine… I think “demanding” is one of the men’s favorite words to describe women. I’ve been called that many times, I’m used to it )

March 23rd, 2006

Lei the Mercenary added

Christopher, yes I think I’ll just email you the avatar I have in mind. Tnx! )

March 23rd, 2006

Feed for Battle of the Sexes : Chris vs Chris

Leave a comment

Names and emails are required (emails aren't displayed), url's are optional.

) (w) (u) p (y) (n) d (*) o) 8) ( (f) (g) (t) o (8) (l) (i) x (~) (e) $ (&amp) (c) ( s (d) (o) (@) (p) (^) (b) [


Fatal error: Call to undefined function show_subscription_checkbox() in /var/www/vhosts/chrisvschris.com/httpdocs/wp-content/themes/vistered-little-cvc/comments.php on line 93