How does update changed attributes only work?

I'm having some trouble understanding how the "Changed Attributes" update behavior works.

Supose I have a query that fetches a row from an entity. I can understand how the behavior works if I change the values directly from the query's record list, and then update the entity. But what if instead of changing the values directly, I assign the query's current row into an auxiliary record, and then make the changes? Will outsystems correctly update only the values that were changed after the assignment, or will it update all attributes?
Hi Ricardo,

This "Changed Attributes" option is based on a data flow analysis. The compiler will basically propagate all the writes on database values until it finds an update node, then it will propagate in the oposite direction (to the datasource) to check which values it should fetch from the database.

There are special cases, like the one you mentioned, where you copy those values to an auxiliary variable. In this case the "dirty" fields of the record are reset when copied from a datasource. 

If you want to know a bit more about this subject you can read (Portuguese only) my MSc Thesis.

best regards,

Hi Hélio,

Thank you for sharing. I have found some other Thesis, OutSystems related, on that database. Cool stuff, I have some reading to do :)
Are there any other goodies like these out there?

Hi Hélio

In the Performance Best Practices.pdf, that I've downloaded from Outsystems site, there is a paragraph saying:
"If you don't need to update all Entity Attributes, consider replacing the Update<Entity> invocation by an Advanced Query using an UPDATE SET statement, setting just the required attributes. Hub Server also uses an UPDATE SET statement, but always updates every attribute."
Is this true if we set the Entity's Update Behavior to "Changed Attributes"? Is the Update statement in an advanced query always a better performance option?

Best regards,
Hi Cláudia,

The documentation seams to be outdated. 
When the "update behavior" is "on" the platform will only send the changed attributes to the database.

I've contacted the team to update the documentation.

Thanks for the heads up.

best regards,
Thanks for the reply Hélio.

I'll be sure to give that a read.