Use ORM for: 1. INSERT, UPDATE, DETELE get one record
Use SQL/Stored Procedure for: SELECTs that involved more complex joins and queries.
Use ORM for: 1. INSERT, UPDATE, DETELE get one record
Use SQL/Stored Procedure for: SELECTs that involved more complex joins and queries.
However, in the select, where'd you'd have to join all three tables, you might use SQL, yes?
I'm just curious how people are using ORMs vs SQL, so sorry for the questions.
If you're using a different ORM then things are probably going to be different. I've worked with a few in various languages and SA is the only one I've found that allows me to express any complex query directly via the ORM. I've heard there are some edge cases where you need to drop down a layer but I haven't run into them yet.
Right now I am working with a suboptimal database design, where I need two nested subqueries to get the most recent event in a related row. I changed them to joins then to (indexed) temporary tables, to try and improve MySQl's performance. It worked to a degree. I doubt that would be possible in an ORM as it is working at the databse level rather than a hgher abstraction.