3 ms·
They are good query composers for simple queries (I'm thinking about Ruby on Rails and Django), useless for complex ones. They're very useful to decode results
by pmontra 8y ago
They are good query composers for simple queries (I'm thinking about Ruby on Rails and Django), useless for complex ones.
They're very useful to decode results in objects of the language and extremely useful to migrate the database.
I don't know about C# but probably the slow downs you're experiencing are in the decode phase.
I'm ok with stored procedures but I'd use them only where it makes sense.
- gigatexal 8y agoI’m super biased but I still hate them. There’s something powerful and simple being able to execute parametered queries. Alas if the industry is going this way then I’ll have to adapt.
- pmontra 8y agoParametered queries == prepared statements? Rails' ActiveRecord creates prepared statements and even caches query results by default. It's pretty useful to write stuff like Book.where(genre: 'scifi').count or Author.where(name: 'Frank Herbert').books.order_by(:publishing_date).first.title. You get the result immediately. Of course title = sql(select title from books ... ) would be quite ok too ( * ), but it turns out that some simple queries are quite long to write. I tend to use SQL only when I have to start looking at the documentation of the ORM. ( * ) I know no tool that can write queries like that but it would be great.
- gigatexal 8y agoSee that conciseness I don’t see as a benefit. I do acknowledge the downside of having a query in a method and maybe having to tweak the same type of query in a handful of methods any time the schema changes. It’s a good way to introduce bugs I guess. At that point I would just use stored procedures.