News for hackers. Stuff that matters.
Re:Ask HN: How do you test SQL? by n0n0n4t0r on Tuesday January 31, 2023 @11:49PM (#34606512)
Off topic incoming (sorry )

I used this trick (join temporaryFoo instead of where foo in ...) in production fifteen years ago, using MySQL. The gain was really astonishing. Several instructions can be optimized using joins on specialty craft tables (I know of LIMIT for instance).

This is one of the worst drawbacks of orm everywhere: nobody even seems to think about those optimisations anymore.

Re:Ask HN: How do you test SQL? by paulmd on Tuesday January 31, 2023 @11:59PM (#34606570)
also, views can be defined as ORM objects/POJOs. They can be read-only, some views are "trivially-remappable" (if there is a 1:1 mapping from view columns to table columns) or even you can use INSTEAD OF INSERT/UPDATE triggers to take writes on that view and do something completely else with it. ;)

I've used that to do dumb shit like lever a table schema into an ORM mapping that it wasn't really designed for, that I had to maintain fallback compatibility conditions onto the tables.

views are really a db-level "interface" implementation that few people really exploit fully. Here is the definition, here is the implementation. And yes global temporary tables are such a cute cheat for unlimited-size query-specific data ;)

Re:Ask HN: How do you test SQL? by MrBuddyCasino on Wednesday February 01, 2023 @02:26AM (#34607537)
That is why ORMs have fallzout of fashion.