Secondary data: persistent vs. virtual



For students who study 1C:Professional course.

#1
People who like this:0Yes/0No
Just came
Rating: 1
Joined: Mar 30, 2015
Company: Webcustoms IT Solutions GmbH

Hi,

what exactly are the pros and cons related to secondary data comparing the persistent
to the virtual variant? Is one of them more efficient or more robust towards future changes?

 
#2
People who like this:0Yes/0No
Moderator
1C:Professional
Rating: 4
Joined: May 8, 2013
Company: 1C Company

The important thing about secondary data is that they are always calculated, and, obviously, this calculation takes resources. Calculating the secondary data, we are slowing down the system and increasing its response time. The difference between persistent and virtual secondary data is all about when we want the resources to be spent or (which is the same thing) what operation we want (or can afford) to slow down.

Persistent secondary data calculation takes place when primary data are changed, i.e. during write operations (saving and posting documents and so on). Virtual secondary data calculation takes place during read operations (refreshing forms, filling out reports and so on).

Note, that persistent secondary data usually calculated less frequently than virtual secondary data (because data are read more often than they are written), but the calculation itself is more complex.

One more thing to consider is developer's resources. Persistent secondary data calculation takes much more time to implement and maintain. You need to follow specific practices to reduce the likelihood of errors and allow developers to make changes in the code easier. In that sense, virtual secondary data look more natural and less messy.

All in all, it's really hard to say in advance, which type of secondary data is a better choice in each case. Therefore, the most practical advice will be the following: use virtual secondary data until you see that some specific read operation needs to be speeded up. Then introduce the persistent secondary data (only for this specific reading case). Remember, that speeding up the reading you are slowing down the writing, but if you do everything right, this slowing down won't be noticeable.

 
Subscribe