Hi guys,


So I was reading some of OutSystems best practice rules regarding queries and it states the following:

I got confused seeing that it says this is because the platform will update every attribute but when you look at the advanced options of an entity, the default behaviour seems to already update only the changed attributes:


So what's the difference?


Thanks in advance.

Hi,


The difference is the best practice is talking about a Bulk Operation..

Update behaviour is for a single record to be updated, to be already efficient.

The best practice refers to Bulk operations, when you need 1000 records updated it might be more efficent to do it in ONE advanced query.

Hi Ricardo,


I think the advanced option is mainly about efficiency/speed at dbms level.  But you are still forced to retrieve all attributes before invoking the update entity action.  You need to pass all of them into import of entity action, even if they did't change.

This best practice relates to a scenario where you want to update a limited number of attributes.  A typical example I can imagine is updating a status on an entity reflecting some state transition.  Using an update set sql statement allows you to do the update without first at some point having to read all attributes, all you need is the id and the value of the columns you want to change.


Dorine