Scope: managed applications, mobile applications, and ordinary applications.
- A register is expected to have a large amount of data (for example, it is appropriate for a register with product prices but not relevant for a register with exchange rates).
- A configuration supports frequent queries to slices of the last ones at the current point in time and/or slices of the first ones to get relevant data (that is, when the period is not specified in parameters of virtual tables SliceFirst and SliceLast).
- While other conditions for virtual tables SliceFirst and SliceLast are specified only for values of dimensions (and separators in the Independent and shared mode).
- In register data access restrictions, only dimensions (and separators in the Independent and shared mode) are used.
For a complete list of all conditions when queries involve information register totals, see 1C:Enterprise platform documentation.
For example, if a configuration supports frequent queries to the ProductPrices register to get the current product prices:
Products.ProductID AS ProductID,
ProductsPrices.Price AS Price,
Catalog.Products AS Products
LEFT JOIN InformationRegister.ProductsPrices.SliceLast(, PriceType = &PriceType) AS ProductsPrices
BY ProductsPrices.Products = Products.Ref
provided that all the above mentioned conditions are met, setting the Enable totals for retrieving slice last will significantly speed up execution of such queries by selecting data directly from additional tables that store only last values (for slice last) and first values (for slice first).
For example, if data is written to the ProductsPrices register with future date, and a query to this register is always executed on the current date upon goods selection (the date is explicitly set in the parameter of the SliceLast virtual table), totals will not speed up execution of such queries. Since totals are built only for first and last records of the register.
If you analyze whether there are recorders with future date upon goods selection form opening and if they are absent, execute another query to slice last without setting the date. This query will be executed much faster.
- Queries to virtual tables of slice first/last of a periodic information register are most often (always) executed for a specific period (for example, on a document date).
- In conditions for virtual tables SliceFirst and SliceLast, subqueries and joins (dot-separated calls to fields of linked tables) are most often (always) used. For example, in this case:
InformationRegister.ExchangeRates.SliceLast(, Currency.Code = &WarehouseCurrencyCode) AS ExchangeRates
An exception is made when totals update is forcibly disabled upon write by calling the InformationRegisterManager. SetTotalsUsage(False) method.