Avatar

“Substitute” SQL’s statements by PHP (Features)

by pdp-7, Thursday, May 16, 2019, 09:45 (1808 days ago) @ Alfie

Theoretically yes. In my forum I have ~20,000 posts (I guess there are much larger installations). If you would return all into an array in PHP and do the job there, it would be much less efficient. In the worst case you’ll run into memory issues. I would not even try to substitute the SQL’s JOIN-statement in PHP…
SQL is fast cause it is optimized for this kind business (not at least by using indexed fields). PHP would be terribly slooow.

Of course you don't suck ALL from the DB and start crunching that BIG blob of data.

What I meant that your PHP controls the pagination in the way that you have this 26 to 50 window you want those posts, as mentioned earlier. But you get those titles one by one from 26 until count is 50 so that way SQL would be much simpler and you just need to ++i and then send that request to DB...

So first it gets number 26 then in PHP ++i and then sql request for 27 and so on ...

Hope this makes more sense. But like I said before I have no clues how you have solved things in your code so this might be too big change to do.

But just popped into my mind.

--
MOV AX,5301
XOR BX,BX
INT 15
MOV AX,530E
XOR BX,BX
MOV CX,0102
INT 15
MOV AX,5307
MOV BX,0001
MOV CX,0003
INT 15
RET


Complete thread:

 RSS Feed of thread