View more context

 

theruss

Just went through the same decision myself last week.

heggsta

Hello all... given that I don't fully get how SS implements query optimisation techniques, I just wondered what the most efficient way of getting just a single DB column for some records would be: build it using an SQLSelect, or use get()->filter(<some filters>)->column('FieldName')?

theruss

@heggsta Always default to using the ORM first. If you have a look at DataObject::get() and DataObject::get_one() (and others) you'll see how they leverage an internal query-cache.

theruss

Goes without saying, but try not to optimise until you need to optimise.

heggsta

thanks @theruss - i'll dig a bit deeper at how they work

👍 (1)
theruss

There are definetly cases when SQLSect and friends should be used, but in my experience, they are few.

heggsta

i actually ended up using an SQLSelect because it was easy enough, but if other methods optimize with internal caching that sounds like the best way to do things