Re:SQL is 43 years old – Here’s why we still use it today
by dunham on Tuesday May 02, 2017 @01:02PM
(#14248173)
Yeah, profiling helps a little. It taught me that queries flush (and you can easily go n^2 from that if you're not careful).
More recently, we've had n+1 issues (putting a printing breakpoint in EntityType.loadByUniqueKey helped me track down where). My hack to get around that was to do a bulk Criteria query up front to pre-load the session cache with the entities that were being fetched one at a time.
There were a lot of quirks that I've had to learn over the last decade, and I'm still discovering more.
More recently, we've had n+1 issues (putting a printing breakpoint in EntityType.loadByUniqueKey helped me track down where). My hack to get around that was to do a bulk Criteria query up front to pre-load the session cache with the entities that were being fetched one at a time.
There were a lot of quirks that I've had to learn over the last decade, and I'm still discovering more.