News for hackers. Stuff that matters.
Re:You Can Do It in SQL, Stop Writing Extra Code for That by craftyguy on Friday December 14, 2018 @01:54PM (#18683466)
Well, obviously limiting results/rows should be done in SQL.. but that's not what the article is demonstrating..
Re:You Can Do It in SQL, Stop Writing Extra Code for That by danzig13 on Friday December 14, 2018 @02:09PM (#18683604)
- Advanced sorting plus pagination comes to mind. How would you do that without pulling unnecessary rows? - GROUP_CONCAT or STUFF in SQL Server already decreases the number of rows. His example has one row returned instead of 3. - Aggregating in SQL would also reduce number of rows returned instead of pulling all the aggregated rows to code and doing it there - I would guess RDBMS implementations are in something faster than the ORM is implemented in and their code is more optimized - that would be speculation.

Also, his examples are like the tip of the iceberg. There are all kinds of things like windowing functions and common table expressions that have so much power to get exactly as much data as you need right at the RDBMS without having to carry that baggage anywhere else.

Re:You Can Do It in SQL, Stop Writing Extra Code for That by tomnipotent on Friday December 14, 2018 @02:09PM (#18683591)
Still all boils down to the same thing - keeping the computation & data as close to possible will always be more efficient.