Kiwibonga Advance Message Boards
Register | Member List | Site main | Board main
Login
Login:
Password:
1 user(s) online: 1 guest - 287 visitors in the last 24 hours.
Happy Birthday to: Vitriolic!

   Kiwibonga Advance > Kiwibonga Advance Boards > General Chat > Testing something > Reply

Post a Reply
Text:

Preview message

  
+Chaos
01/03/2005
05:39:01AM
Good job. And it only took you three months to boot. :P
@kiwibonga
01/03/2005
04:42:04AM
Haha... Let's gravedig!

Imagine having a book with 8000 chapters, and you want to get chapter #930... But they're not actually in the correct order... And you don't have an INDEX!

That's pretty much what was happening... I forgot to set indexes on the id numbers of posts, usernames, threads, etc...

So that 1.5 second query is down to a more normal 0.2 seconds :D

*bows*
+Zem
10/01/2004
08:00:57PM
The point is, if it's taking 1.5 seconds to select 100 rows in a simple query, something is wrong. Which could be bad. Probably not, but better safe than sorry, right?

Maybe your sql server just sucks balls. :D
@kiwibonga
09/30/2004
11:50:03PM
Basically, given the speed of the host (I can get around 465k/s which I didn't know my connection could reach), 1.5 seconds is huge! It's almost enough time to download 1Mb of data!
+Chaos
09/30/2004
09:57:04PM
Yes it is. That's a second and a half I'll never get back!
+Hyena
09/30/2004
04:31:00AM
Uhm, I realize that 1.5 seconds is terribly inefficient for you, but I mean, waiting 1.5 seconds is not a terrible strain on a forum-goer's patience.
Angel of Doom
09/30/2004
02:54:03AM
Dammit Kiwi! I'm having trouble writing a basic bank java code, and your optimizing your SQL queries!
@kiwibonga
09/28/2004
03:30:28AM
hehehe, if you have any trouble with that class, you know who to ask ;p
Suppo
09/28/2004
12:58:10AM
I personnally just learned today in my "introduction to photoshop" class what were bytes and bits...

yep... I'm not so sure I'll keep going to that class that long.
+Chaos
09/27/2004
04:49:39PM
*pretends to understand*

Yep...
@kiwibonga
09/27/2004
05:04:44AM
Wicked fast, baby.

Yeah... I decided to get rid of that horrible code that recounts how many threads there are in every friggin forum and does all that stupid crap to resynchronize everything when you post... So I think post/thread counts for forums (in the forum index) don't update anymore unless I trigger it... On the plus side it doesn't take 5-10 seconds before your post gets posted. Hooray.

Also I realized that it took 1.5 seconds to see the last 100 posts. I was in shock when I saw the highly unoptimized code I had there.

So I replaced it to something optimized, changed the total number of mysql queries from a few hundred to one.

Well fucking guess what, still 1.5 seconds. There is no rational explanation.

This:
$numlast=getnum("SELECT id FROM board_posts ORDER BY time DESC LIMIT 100");
for($i=0;$i<$numlast;$i++)
{
$thispost=getarray("SELECT id, thread, author, time FROM board_posts ORDER BY time DESC LIMIT $i,1");
$thethread=getarray("SELECT subject, numposts FROM board_threads WHERE id=$thispost[thread] LIMIT 1");
if($_COOKIE[cookieid]){$u=getarray("SELECT ppp FROM userstats WHERE id=$_COOKIE[cookieid] LIMIT 1");$ppp=$u[ppp];}
else{$ppp=30;}
$refpage=floor(($thethread[numposts]-1)/$ppp);
$lastmbp.="<tr><td><a href=thread.php?id=$thispost[thread]&page=$refpage#$thispost[id]>$thethread[subject]</a></td><td>".dispuser($thispost[author])."</td><td>".telldate($thispost[time])." ".telltime($thispost[time])."</td></tr>";
}


got changed to this:

$query=mysql_query("SELECT
board_posts.id AS postid, board_posts.thread AS postthread, board_posts.time AS posttime, board_posts.author AS postauthor,
board_threads.subject AS threadsubject, board_threads.numposts,
users.name AS authorname
FROM board_posts, board_threads, users
WHERE board_threads.id=board_posts.thread
AND users.id=board_posts.author
ORDER BY posttime DESC LIMIT 100");

if($_COOKIE[cookieid]){$u=getarray("SELECT ppp FROM userstats WHERE id=$_COOKIE[cookieid] LIMIT 1");$ppp=$u[ppp];}
else{$ppp=30;}

while($postlist=mysql_fetch_array($query))
{
$refpage=floor(($postlist[numposts]-1)/$ppp);
$lastmbp.="<tr><td><a href=thread.php?id=$postlist[postthread]&page=$refpage#$postlist[postid]>$postlist[threadsubject]</a></td><td><a href=http://www.kiwibonga.com/gba/profile.php?id=$postlist[postauthor]>$postlist[authorname]</a></td><td>".telldate($postlist[posttime])." ".telltime($postlist[posttime])."</td></tr>";

}


And it's still as slow. I just don't get it.

Edit: Still as slow. This site can eat me :D
   Kiwibonga Advance > Kiwibonga Advance Boards > General Chat > Testing something > Reply



© 2002 Kiwibonga.com - 158.0436 visitors per day - rendered in 0.023 seconds.