Home | Forum | Unread | Sign in | Sign in | Beta? | Wiki
The Phoenyx
your roleplaying community

news > stakeholders > main

"To take no part in the running of the community's affairs is to be either a beast or a god!" --Aristotle
Subscribe | Unread | Recent | Group options | Topic options | Post
KarenCravens
Karen Cravens

Sun

Dec 30
2007

04:37Z

Facepalm

I put some logging functions on the SQL functions, so that it tells me the conditions under which any query over 3 seconds ran.
Moderators web-approving non-reply posts, and web users attempting to start threads, will appreciate the fact that I discovered and hopefully fixed (it's NOT in the live install yet, because if I do it wrong threading breaks) a really boneheaded mistake.
Before creating a new thread, the server tries every method it can to make sure a post is not supposed to be a reply. It looks in the obvious places ("In-Reply-To" and "References"), then it tries to match by subject, then it tries a fuzzy match by subject. The last bit can be a little expensive; the post that caught my attention took 18 seconds on one try.
That's not good in itself, but the boneheaded part was that it does that search as a function, called "parent." After the first time, the function returns a stored result. *Except* when it didn't find a parent, and then it doesn't have a stored result so it does the search.
The "parent" function gets referred to TWENTY-FOUR TIMES in the course of storing a message. Twenty-four subject searches. Twenty-four fuzzy subject searches (taking from 3 to 18 seconds each). I didn't log the total time to serve that particular request, but I'm pretty sure Andrew had time to go fix coffee, or a seven-course dinner, while it was running.
So, um. The rule here has been "Get it working. *Then* get it working *right*." Because for something like seven years I've been trying to write Gamehawk *right*. So now it's working, and now I'm working on making it work *right*.
*Really* could use a dedicated SQL person, though... yeesh.
Subject (required)




 
Refresh