Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

TIL lateral joins exist, and I struggled to understand what exactly they did because for some reasons all the blog posts and whatnot were so convoluted. Then I found this[1] SO answer, which lit my bulb.

We're using such subqueries a lot, often for many columns in the same child table, and we're moving to MSSQL so will definitely change to using lateral join (or cross apply as MSSQL calls it).

[1]: https://stackoverflow.com/a/28550962



Sadly, it seems that CROSS APPLY in MSSQL can be slow. Not sure why, but it was ~3x slower for typical queries we have. Oh well...




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: