Why is ORM considered good but “select *” considered bad?

后端 未结 12 1672
误落风尘
误落风尘 2021-01-29 23:25

Doesn\'t an ORM usually involve doing something like a select *?

If I have a table, MyThing, with column A, B, C, D, etc, then there typically would be an object, MyThin

12条回答
  •  醉话见心
    2021-01-30 00:05

    If you're using query caching select * can be good. If you're selecting a different assortment of columns every time you hit a table, it could just be getting the cached select * for all of those queries.

    I think you're confusing the purpose of ORM. ORM is meant to map a domain model or similar to a table in a database or some data storage convention. It's not meant to make your application more computationally efficient or even expected to.

提交回复
热议问题