Ranter
Join devRant
Do all the things like
++ or -- rants, post your own rants, comment on others' rants and build your customized dev avatar
Sign Up
Pipeless API
From the creators of devRant, Pipeless lets you power real-time personalized recommendations and activity feeds using a simple API
Learn More
Comments
-
Okay, think there's something to learn for me, how would a statement look like if you have to query the database for all user ids in the array? Only thing I can think of is exactly this solution :/ Help is appreciated
-
@wolt Thanks for the Answer, I think what you mean is joining(?). I already did some research and I think they mean something like "WHERE id IN (1,50,30)" I didn't knew/forgot that mysql can do this, of course you can join the name etc. than too.
-
@Bitwise While I agree, with PHP backend development you can generally forget about language optimizations.
90% of both execution time and memory usage will be the overly generic ORM bashing against the database, 9% is framework bootstrapping & request middlewares... 1% is about the way you handle loops, objects, arrays and collections.
ORMs like Eloquent (and Doctrine to a lesser degree) love utilizing/abusing memory. They instantiate objects by the thousands, and keep everything laying around. "select *" is the default, eager loading of relations is often a necessity, and the object/relational impedance problem makes it attractive to drag data to the webserver.
If you want to speed up request times in PHP frameworks, all that matters is queries.
Bob?
Yeah?
Bob, could you hand me that paperclip?
Sure mate!
Thanks.
Oh... Bob?
Uhhh... yeah?
Could you also hand me that paperclip?
Right... sure, of course.
Thanks.
Bob?
What?
Could you also hand me the next paperclip?
Fuck off, why don't I just give you the whole fucking box!
Yeah Bob, please, throw the whole fucking box.
Wait, is that a printed screenshot of my code you're attaching the paperclips to?
It sure is, Bob.
undefined
bob is a bit slow