Hi everyone. I just subscribed, but read the previous threads, specially the one on Wikipedia Dead Again.
All my apologies, i'm the one who killed the server by doing a bad query.
I don't ask for forgiveness, but i just want to explain what i did, because 1) i think it's the right thing to do 2) i wonder about something
(working on the fr database, btw)
So here's what i did: * first i did a query to try to find articles with a link to a redirect (and thus fix those links). It was around 11:30 (french hour). iirc the query was:
select l.cur_title, r.cur_title from cur l inner join links lnk on l.cur_title = lnk.l_from inner join cur r on r.cur_title = lnk.l_to where r.cur_text like '%#redirect%'
Note that it's the same as the killing one, without the 'binary'. It took a few minutes, server down during that time (already bad), around 5 i think, then i got some answers. Many duplicates, as string comparison seems case-insensitive. But the server WAS responding after it, of that I'm quite sure.
So i checked MySQL docs, and found the 'binary' trick to force case-sensitivity for comparisons. Now before doing the query again, i wanted to check how many records there are in 'links' table.
So here comes the easy query:
select count( * ) from links
Here is what is weird: after that one, the server didn't reply. I don't remember doing the query with the 'binary', though i probably did it since it's in the logs ^_-
I think i have recollection troubles, probably due to the shame of having killed the server -.-
Learned lessons: 1) learn the database format before doing big queries 2) use the 'explain' keyword (thanks Brian for that one) 3) install the database to my local comp to play with queries without killing everything !
Ryo who will take extra care with requests...
On Thu, 27 Mar 2003, Weeger Nicolas wrote:
Hi everyone. I just subscribed, but read the previous threads, specially the one on Wikipedia Dead Again.
All my apologies, i'm the one who killed the server by doing a bad query.
I don't ask for forgiveness, but i just want to explain what i did, because 1) i think it's the right thing to do 2) i wonder about something
(working on the fr database, btw)
So here's what i did:
- first i did a query to try to find articles with a link to a redirect (and thus fix those links). It was around 11:30 (french hour).
iirc the query was:
select l.cur_title, r.cur_title from cur l inner join links lnk on l.cur_title = lnk.l_from inner join cur r on r.cur_title = lnk.l_to where r.cur_text like '%#redirect%'
I know SQL only through what I know through Wikipedia, and I don't know things like 'inner join', but "r.cur_text like '%#redirect%'" would certainly be better as "r.cur_is_redirect=1". The way I would do this query is:
SELECT l_from,cur_title FROM links,cur WHERE l_to=cur_id AND cur_is_redirect=1 (although in general I do not see any need to bother with 'repairing' this anyway)
Andre Engels
wikitech-l@lists.wikimedia.org