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

by Alfie ⌂ @, Vienna, Austria, Thursday, May 16, 2019, 09:17 (8 days ago) @ pdp-7

Hi pdp-7,

Just wondering if that kind of pagination would be possible to do by other mean than with SQL? [… ] I mean use simple SQL and roll that data in one by one and not in chunk like in your example? Would make SQL simple and PHP does the magic of 26 to 50 ..

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.

Best regards,
Alfie (Helmut Schütz)
BEBA-Forum (v1.8β)

Complete thread:

 RSS Feed of thread

powered by my little forum