Skip to content

#012 IMPROVE PERFORMANCE WITH PARTIAL RECORDS

Since the release of Business Central 2020 wave 2, we got a new capability called Partial Records. It consists in the possibility to specify the fields that should be loaded from a Record or RecordRef.

Without the use of Partial Records, Business Central would load all data from the record even if you only needed to access one or two fields.

 
SetLoadFields

Specifies a set of fields to be initially loaded when the record is retrieved from its data source. A call to this method will overwrite any fields that were previously set to load.

Example of code:

SetLoadFields

AddLoadFields

Similar function to SetLoadFields that has one big difference: if the function is called multiple times, the new call does not reset fields that were already set (even if they were set using SetLoadFields).

Important notice

If the AL Code accesses a field that has not been selected for loading, the platform will perform an implicit GET, loading all the fields from the Record.

The benefits

  • Microsoft states that it’s particularly beneficial when table extensions are used. Each table extension is a separate table in SQL and when the data from a table is loaded, SQL will join the table and the extensions using the primary key.
  • This feature is especially advantageous in reading-based scenarios as it’s not recommended to use partial records on a record that will do inserts, deletes, or copies to temporary records.
  • Also in Microsoft docs: <<Testing on the previous example code showed that the execution time for loading only the “Standard Cost” field was nine times faster than loading all normal fields.>>

Recently added on BC19

  • Partial Records on List Pages – the server will read only those fields shown in the TableRelation lookup page from the database.
  • Partial Records on TableRelation Lookup Pages – the server will read only those fields that are shown in the list page from the database.