Re:Frameworks Don't Make Much Sense
by afarrell on Friday March 11, 2016 @01:34AM
(#11265011)
I have been thinking of writing an SQL tutorial specifically for folks who have only worked in ORMs. Do folks here have a favorite SQL tutorial that I should look at for stylistic inspiration?
[ Parent
| on HN ]
Re:Frameworks Don't Make Much Sense
by marcus_holmes on Friday March 11, 2016 @02:31AM
(#11265217)
The things that no-one seems to know about from ORMs are:
1. Stored procedures. the idea that you treat your SQL like other code, and put it in sprocs, parameterise it, version it, etc.
2. Optimising tables and playing around with different normal forms and indexes to get the best results. Database design, basically. The 1:1 Object:Table mapping that ORMs use is not always optimal.
3. Indexing multiple fields that get queried together. If you commonly query on user name and state, then create an index for that. Maybe. If that table is read from more than it's written to. If read time optimisation is more important than write time optimisation.
I haven't looked at a SQL tutorial recently, so I can't help with that, sorry
I'm spoiled by ORM's, but I have no problem using SQL to query the database. What I have trouble with though is creating tables using raw SQL and managing schema migrations. Even when using an ORM it seems kind of messy. I'd love a tutorial on how to properly maintain migrations without an ORM.