|
Posted by Sandman on 11/23/06 22:56
In article <45662179.6080701@attglobal.net>,
Jerry Stuckle <jstucklex@attglobal.net> wrote:
> >>First: Prefetching all members into memory for each page where you need one
> >>or two members is absolutely a no-go. You must change that of course.
> >>Just fetch the information you need WHEN you need it.
> >
> > Yes, but if I need to fetch information for 100 members on one page
> > making 100 individual SQL queries is also a no-go.
>
> This is the part I don't understand. I don't make 100 individual SQL
> queries.
I didn't say you did. For my problem there seems to be two obvious
solutions:
1. Fetch all information for every page (today this takes 0.8 seconds
generally, which is far too long).
2. Fetch information once per instance it is needed
1 is still the best way, performance-wise, to solve a page with 100
instances of members, while 2 works best when there is maybe 1-5
instances.
> >>If I understand correctly your main problem lies in the fact you must fetch
> >>the online/offline information for each possible user.
> >>Correct?
> >
> > No, there are lots of other information also being fetched. The
> > online/offline status is kept in a seperate db and isn't a problem at
> > all actually. Nicknames, labels, ages, full name and such things are
> > what is needed. All of that is in the member DB
>
> OK, that's the problem. They should be in the same DB, but perhaps in
> different tables. Then a JOIN should get you everything you want in one
> query.
(they are in the same db but in another table, I misspoke)
But that query would still have to fetch all thousands of members at
one go.
Again - online/offline status is *not* the reason I need this. I have
to be able to display any part of the static information about any
arbitrary member at any given time in my pages.
> >>But this solution has the advantage that:
> >>- You don't load all users into memory for each scriptinvocation
> >>- Your tblOnlineUsers can be searched very quickly.
> >
> >
> > Yeah, I'm already doing that. I still need some way to get information
> > about arbitrary user X whenever I need it. One way would be to just
> > print "[[MEMBERINFO:123]]" and then save "123" in an array, fetch
> > information about all id's in that array and then preg_replace() them
> > all in the output buffer. But that's not very intelligent either,
> > since a SQL query with "select x, x, x from member where id in(<list
> > of 100's of ids>)" isn't very good.
> >
> > So, basically, I need a function to get information about user X from
> > a member count of tens of thousands while not being time consuming if
> > I do it one time on a page or if I do it 100 times on a page.
--
Sandman[.net]
Navigation:
[Reply to this message]
|