Snitz Forums 2000
Snitz Forums 2000
Home | Profile | Register | Active Topics | Members | Search | FAQ
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 Snitz Forums 2000 DEV-Group
 DEV Discussions (General)
 Paging Efficiency Query
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

Shaggy
Support Moderator

Ireland
6780 Posts

Posted - 25 October 2005 :  11:37:25  Show Profile  Reply with Quote
Was looking at a couple of base files earlier and breezed over some of the code that handles the paging in topic.asp (although that's not the only file this appears in) spotting the following code in the MySQL specific code on line 333:
if mypage > 1 then
	intOffset = cLng((mypage-1) * strPageSize)
	strSql5 = " LIMIT " & intOffset & ", " & strPageSize & " "
end if
Now, granted, I'm nowhere near an expert on optimising databases and recordsets for maximum efficiency but would it not be beneficial to remove the if statement from that block of code? As it is at the moment, when viewing the first page of a topic and using a MySQL database, all replies for the given topic are going to be pulled from the database into the database. Would it not be better to simply pull the replies we know we're going to need rather than all of them?

<

Search is your friend
“I was having a mildly paranoid day, mostly due to the
fact that the mad priest lady from over the river had
taken to nailing weasels to my front door again.”

Podge
Support Moderator

Ireland
3775 Posts

Posted - 25 October 2005 :  15:27:33  Show Profile  Send Podge an ICQ Message  Send Podge a Yahoo! Message  Reply with Quote
You're right. Can't you just add something like this

if mypage > 1 then
	intOffset = cLng((mypage-1) * strPageSize)
	strSql5 = " LIMIT " & intOffset & ", " & strPageSize & " "
else
        'mypage = 1
	strSql5 = " LIMIT 0, " & strPageSize & " "
end if
<

Podge.

The Hunger Site - Click to donate free food | My Blog | Snitz 3.4.05 AutoInstall (Beta!)

My Mods: CAPTCHA Mod | GateKeeper Mod
Tutorial: Enable subscriptions on your board

Warning: The post above or below may contain nuts.
Go to Top of Page

Podge
Support Moderator

Ireland
3775 Posts

Posted - 25 October 2005 :  15:29:43  Show Profile  Send Podge an ICQ Message  Send Podge a Yahoo! Message  Reply with Quote
Actually, I think this would work too


if mypage > 1 then
	intOffset = cLng((mypage-1) * strPageSize)
	strSql5 = " LIMIT " & intOffset & ", " & strPageSize & " "
end if
<

Podge.

The Hunger Site - Click to donate free food | My Blog | Snitz 3.4.05 AutoInstall (Beta!)

My Mods: CAPTCHA Mod | GateKeeper Mod
Tutorial: Enable subscriptions on your board

Warning: The post above or below may contain nuts.
Go to Top of Page

Shaggy
Support Moderator

Ireland
6780 Posts

Posted - 26 October 2005 :  08:03:01  Show Profile  Reply with Quote
Ay, when mypage is 1, mypage-1 will be 0 and, therefore, (mypage-1)*strPageSize will also be 0.

<

Search is your friend
“I was having a mildly paranoid day, mostly due to the
fact that the mad priest lady from over the river had
taken to nailing weasels to my front door again.”
Go to Top of Page

tribaliztic
Senior Member

Sweden
1532 Posts

Posted - 26 October 2005 :  08:13:43  Show Profile  Visit tribaliztic's Homepage  Send tribaliztic an ICQ Message  Reply with Quote
Hm.. Is this something we all should fix? =)
Everything that can speed up the site is interesting..
<

/Tribaliztic
- www.gotlandrace.se -
Go to Top of Page

Podge
Support Moderator

Ireland
3775 Posts

Posted - 26 October 2005 :  08:52:21  Show Profile  Send Podge an ICQ Message  Send Podge a Yahoo! Message  Reply with Quote
Well caught Shaggy.<

Podge.

The Hunger Site - Click to donate free food | My Blog | Snitz 3.4.05 AutoInstall (Beta!)

My Mods: CAPTCHA Mod | GateKeeper Mod
Tutorial: Enable subscriptions on your board

Warning: The post above or below may contain nuts.
Go to Top of Page

Shaggy
Support Moderator

Ireland
6780 Posts

Posted - 26 October 2005 :  09:11:10  Show Profile  Reply with Quote
Thanks, Podge. As I said in my original post, this appears in a few other files as well, such as forum.asp. I'll post back with a full list with line numbers shortly.

<

Search is your friend
“I was having a mildly paranoid day, mostly due to the
fact that the mad priest lady from over the river had
taken to nailing weasels to my front door again.”
Go to Top of Page

HuwR
Forum Admin

United Kingdom
20584 Posts

Posted - 26 October 2005 :  10:31:38  Show Profile  Visit HuwR's Homepage  Reply with Quote
quote:
Originally posted by tribaliztic

Hm.. Is this something we all should fix? =)
Everything that can speed up the site is interesting..



only if you are using MySQL<
Go to Top of Page

tribaliztic
Senior Member

Sweden
1532 Posts

Posted - 26 October 2005 :  10:35:50  Show Profile  Visit tribaliztic's Homepage  Send tribaliztic an ICQ Message  Reply with Quote
Okay, I'll wait for Shaggy's full list of instances and fix this on my forum then. Thanks HuwR!
(And shaggy =))
<

/Tribaliztic
- www.gotlandrace.se -
Go to Top of Page

Shaggy
Support Moderator

Ireland
6780 Posts

Posted - 26 October 2005 :  11:35:51  Show Profile  Reply with Quote
Here ye go:

admin_accounts_pending.asp - line 227
admin_emaillist.asp - line 66
forum.asp - line 283
members.asp - line 184
moderate.asp - line 130
search.asp - line 301
topic.asp - line 333

<

Search is your friend
“I was having a mildly paranoid day, mostly due to the
fact that the mad priest lady from over the river had
taken to nailing weasels to my front door again.”
Go to Top of Page

Shaggy
Support Moderator

Ireland
6780 Posts

Posted - 27 September 2006 :  13:33:34  Show Profile  Reply with Quote
Just bumping this one for the dev team's consideration

<

Search is your friend
“I was having a mildly paranoid day, mostly due to the
fact that the mad priest lady from over the river had
taken to nailing weasels to my front door again.”
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
Snitz Forums 2000 © 2000-2021 Snitz™ Communications Go To Top Of Page
This page was generated in 0.12 seconds. Powered By: Snitz Forums 2000 Version 3.4.07