TP-Docs
HTML5 Icon HTML5 Icon HTML5 Icon
TP on Social Media

Recent

Welcome to TinyPortal. Please login or sign up.

June 25, 2024, 06:38:47 AM

Login with username, password and session length
Members
Stats
  • Total Posts: 195,280
  • Total Topics: 21,227
  • Online today: 190
  • Online ever: 3,540 (September 03, 2022, 01:38:54 AM)
Users Online
  • Users: 0
  • Guests: 71
  • Total: 71

[Block] Top Karma w/ Linked Avatar

Started by tim antley, September 04, 2008, 07:35:37 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Ianedres

It does a substantial amount of retrieval since it has to load each members good and bad karma values, and then the associated avatar information with it.

Perhaps it should only retrieve the karma value and member ID into an array, and THEN load only the top x members (as set in the limit) by using the loadmember functions for the avatar information...

IchBin

Well, what my thinking was that the code is looping through, running the memberLoadData each time for each user. This means a single query for each user. Disable the block and look at how man queries your site uses at the bottom of your page. Then enable the block and refresh the same page. See how many queries the block adds.

Ianedres

Well, I guess I looked it over too quick- it is doing the minimal amount of query work that my feeble mind can write, as it is doing just as my previous post suggested.

Obviously, if you are requesting the top 100 members by karma, then it is going to add quite a bit to the query count, so it would be more practical to use top five or ten perhaps without seriously affecting the load on the SQL server.

Optionally, you could set options for members only, or only on a certain page rather than in a block that is displayed on each and every page...

IchBin

Sorry I should have been more forth coming on my questions here. I am merely asking because when I used the function in the same manner you have here, my front page went from like 30 queries to 50 because of the loop. I was doing this on my User Online avatar snippet. So I had to change it to call all the users and avatars in 1 query. I was just wondering if I had missed something in that made the functions call an array of users instead of one at a time, which requires a single query for each time it loops. Anyway, I'll quit babbling now. lol

jdvarner

for some reason... when using this block it makes my site extremely slow and 1/2 the time the site came up with server error. but when removed the site was back to normal and navigation was a breeze. just letting you know the experience i had with it.

Ianedres

I do appreciate the report- for reference, what is the $limit variable set to?

If you're experiencing poor server response from a minimal amount of avatars and over an extended period of time, then I would not use it. It uses the simplest query that I know to get the information and present it in the block.

jdvarner

i had it set to "1". got the same result with "1" and "5"