UseTablockHint(hint: CubeMetaUpdateHintQuery): Boolean;
hint. Types of queries, for which TABLOCK is specified.
The UseTablockHint property determines which queries will be executed with the TABLOCK hint.
The property is relevant if the work is executed in repositories based on Microsoft SQL Server DBMS. The property is set to True for all query types by default, queries are executed with the TABLOCK hint. TABLOCK allows for locking tables, for which queries are executed, minimizing the number of log records, and also executing other functions depending on the instruction followed. For details see the manufacturer website.
Executing the example requires that the repository contains a time series database with the TSDB identifier and a folder with the TSDB_COPY_FOLDER identifier.
Add links to the Cubes, Metabase system assemblies.
Sub UserProc;
Var
Mb: IMetabase;
RubUpdateEx: ICubeMetaUpdateEx;
Rub: IRubricator;
CrInfo: IMetabaseObjectCreateInfo;
Begin
// Get current repository
Mb := MetabaseClass.Active;
// Create an object for copying time series database
RubUpdateEx := New CubeMetaUpdateClass.Create As ICubeMetaUpdateEx;
// Get time series database
Rub := Mb.ItemById("TSDB").Bind As IRubricator;
// Specify copied time series database
RubUpdateEx.Rubricator := Rub;
// Specify that copying is executed at the current repository
RubUpdateEx.Metabase := Mb;
// Get parameters of created time series database
CrInfo := RubUpdateEx.CreateInfo;
// Specify the folder, in which it will be created
CrInfo.Parent := Mb.ItemById("TSDB_COPY_FOLDER");
// Specify name and identifier of new time series database
CrInfo.Id := Mb.GenerateId("TSDB_COPY");
CrInfo.Name := "Time series dastabase (copy)";
// Specify MDM repository that will be used by
// copied time series database
RubUpdateEx.RdsDatabase := Rub.Database;
// Specify that data will be copied
RubUpdateEx.CopyData := True;
// Specify that nested objects of time series database will be copied
RubUpdateEx.CopyExtraObjects := True;
// Specify that objects will be copied and mapped
// by unique indexes used for creating selection
RubUpdateEx.RemapBySelectionIndex := True;
// Set revision name in copied time series database
RubUpdateEx.NewRevisionName := "Copy entire 'TSDB' database";
// Determine queries, for which the TABLOCK hint will be disabled.
RubUpdateEx.UseTablockHint(CubeMetaUpdateHintQuery.InsertFactsTable) := False;
RubUpdateEx.UseTablockHint(CubeMetaUpdateHintQuery.InsertValsTable) := False;
// Execute copying
RubUpdateEx.Apply(Null);
End Sub UserProc;
After executing the example a copy of the TSDB time series database is created in the specified folder. When copying, queries for updating tabled with indicators and values will be executed without the TABLOCK hint.
See also: