4 ms·
Quite the contrary, ORMs in general are less performant. Using ORMs boils down to two things, convenience and the ability to switch the underlying RDBMS. (For e
by moehm 5y ago
Quite the contrary, ORMs in general are less performant. Using ORMs boils down to two things, convenience and the ability to switch the underlying RDBMS. (For example all the OSS which says you can choose between MySQL, Postgres or SQLite.)
But if you support all RDBMS you only can support the smallest intersection between them and can't use advanced features like CTE, window functions, JSON support etc.
- dragonwriter 5y ago> But if you support all RDBMS you only can support the smallest intersection between them and can't use advanced features like CTE, window functions, JSON support etc. That's not true at all, any more that it’s true of supporting all browsers with JS. You can use the advanced features where available, and implement logically (if not performance)-equivalent functionality using more basic functions where the advanced features aren’t available. Or, if you are lazy, just have a reduced feature set available with less capable RDBMS engines. But, on any case, its simply not the case that an ORM that supports engines of varying capacity is limited to using only the least-common-denominator feature set.
- moehm 5y agoYeah, sure, you can always write raw SQL queries, but that has nothing to do with your ORM, does it? I was talking about ORMs in general, not about the programmer in particular. So yes, you are right that if you have enough engineering resources you can support everything. But most ORMs don't help you with this, so it is not a feature of ORMs. You can always bypass it though. The comparison with JS doesn't fit realy well, because JS is the tool you have to use. You don't have to use ORMs, plain SQL works fine as well.
- rahimnathwani 5y agoWhen GP says 'you can use the advanced features', 'you' refers to the person developing the ORM, not to a developer using the ORM. So the ORM author can do the hard work of allowing advanced features to work across databases. And it's transparent to the developer using the ORM.
- CRConrad 5y agoExcept, how many ORMs do that?
- blowski 5y agoI use Postgres window functions with Hibernate and Doctrine, plus lots of other Postgres-specific functionality. The real benefit of the ORM to me are that: * some query results are cached * the "unit of work" pattern allows me to distribute changes to an entity and then commit it as a transaction. Anyway, the ability to suddenly switch RDBMS only works out in practice if you actively maintain support for multiple engines.