Hmm, when I read the original post, I assumed that what Twin Rose was describing was what the SQL was doing, not what the page was doing. However, I have seen java developers write some very strange code before! The correct way would be to open a SQL cursor of the SELECT statement with an ORDER BY clause and read the first n records, then close the cursor. If, however, the code is issuing SQL to read the whole data set, then doing the sort programatically, then it looks like resistor has just spotted a BIG bit of bad coding that you should be able to correct.resistor said:That just seems like an awfully inefficient way to implement the recent posts thing. I feel like there's got to be some better way to do it.
As an idea, I would suggest looking into using stored procedures (also called triggers) to fetch the most recent posts. Basically, these allow complicated queries (like finding the most recent posts across all forums) to be written in scripts within the database server. This would likely be a speed gain, since it removes the need to transmit large intermediate datasets (all the posts on the forums) from the server to the client. Rather, the server only transmits the final product of the procedure.
I'd be willing to help figure out how to do it, but I'm not familiar with the database model ENWorld uses.
resistor said:That just seems like an awfully inefficient way to implement the recent posts thing. I feel like there's got to be some better way to do it.
As an idea, I would suggest looking into using stored procedures (also called triggers) to fetch the most recent posts. Basically, these allow complicated queries (like finding the most recent posts across all forums) to be written in scripts within the database server. This would likely be a speed gain, since it removes the need to transmit large intermediate datasets (all the posts on the forums) from the server to the client. Rather, the server only transmits the final product of the procedure.
I'd be willing to help figure out how to do it, but I'm not familiar with the database model ENWorld uses.
Twin Rose said:I believe it's partially inefficient because of checks for things like whether or not you have ACCESS to each given forum before showing the thread, so it's a ton of joins, rather than strictly just looking at the date.
Nellisir said:Wow. If that means what I think it does, then that's just...stupid.
Or it doesn't mean that, in which case, nevermind.
Still no frelling big ad on the front page. Still happy.
Nell.
BrooklynKnight said:You know, in further retrospect, my venom was due to a number of contributing factors.
A. My cranky mood.
B. Wystans annoying persitence
C. I think I was trying to say what Morrus couldnt, or wouldnt. He's got far too much tact to speak to members of the site that way. I'm not saying I was speaking for him, mearly that If i was him thats how id react.
In any case the moment is past.
JoeBlank said:Well, I guess someone was convinced that you were a valuable contributor to the site and deserved a membership. And then you agreed, and thought you should stay a member.