ONLINE HELP
 WINDEVWEBDEV AND WINDEV MOBILE

Help / WLanguage / Managing databases / HFSQL / HFSQL functions
WINDEV
WindowsLinuxUniversal Windows 10 AppJavaReports and QueriesUser code (UMC)
WEBDEV
WindowsLinuxPHPWEBDEV - Browser code
WINDEV Mobile
AndroidAndroid Widget iPhone/iPadIOS WidgetApple WatchMac CatalystUniversal Windows 10 App
Others
Stored procedures
Reorganizes the internal structure of the indexes to optimize the speed for accessing the data. Based on HStatCalculate, this function performs several statistical calculations on the keys of a data file.
When to use HAccelerateSpeed?
This function can be used as often as necessary but we advise you to use it after a set of additions (in most cases, after a set of additions corresponding to at least 1 per thousand of the number of records in the database).
Remark: In order for the statistical calculation to be efficient, this calculation must be performed on all data files (for a multi-file query for example).
Caution: This function must not be systematically used in the initialization code of the project. Indeed, optimizing the speed for accessing the data may take quite a long time and the users may be slowed down.
How does HAccelerateSpeed work?
The statistics on the keys of a data file are used when implementing a filter, when creating a query or when creating a view on the data file. The HFSQL engine analyzes the selection condition, then uses these statistics to define the most discriminating items that will be used to optimize iterations on data files.
The statistics are used to get information about the content of the data file when they are calculated. Once the statistics have been calculated:
  • The more the data file is modified, the less accurate the statistics are.
  • The more records the data file contains, the less the modification of a single record impacts the overall statistics.
Caution: HAccelerateSpeed makes the data file read-only while the statistics are calculated (one iteration over the file for each key).
HFSQL Client/Server The statistics can be calculated in background task without locking the data file in write mode.
Example
// Reorganizes the Customer data file on the CustName key
HAccelerateSpeed(Customer, CustName)
Syntax
<Result> = HAccelerateSpeed([<Data file> [, <Key item> [, <Optimization>]]])
<Result>: Boolean
  • True if the reorganization of indexes was performed,
  • False if a problem occurred (file locked by an application for example). HError is used to identify the error.
<Data file>: Optional character string
Name of the data file used. If this name is not specified, HAccelerateSpeed will use the last data file used by the last HFSQL function (function starting with "H").
If this parameter is equal to "*" (without specifying any item), the operation will be performed on all the data files described in the current analysis (including the data files described by HDeclare, HDeclareExternal, HDescribeFile).
Caution: This data file must not be locked by an application.
<Key item>: Optional character string
Name of the key item used to reorganize the indexes. If this name is not specified or if it is equal to "*", the reorganization of indexes will be performed on all the key items of the data file.
<Optimization>: Integer constant
HFSQL Client/Server Used to optimize the reorganization of indexes for the HFSQL Client/Server files.
If this parameter is not specified, the data file used will be locked in write mode.
If this parameter corresponds to the hBackgroundTask constant, the reorganization of indexes will be performed in background task, without locking the data file.
Important: This parameter is taken into account for the HFSQL Client/Server files. In the other cases, the file is automatically locked when the statistics are calculated.
Remarks
  • HAccelerateSpeed does not close the data file.
  • The reorganization of indexes can also be performed by HIndex or by HStatCalculate.
  • In the HFSQL Classic or Client/Server data files, the reorganization of indexes can only be performed on the key items.
  • The syntax HAccelerateSpeed(<Data file>) is equivalent to HAccelerateSpeed(<Data file>, "*")
Business / UI classification: Business Logic
Component: wd300hf.dll
Minimum version required
  • Version 16
This page is also available for…
Comments
Click [Add] to post a comment

Last update: 06/04/2024

Send a report | Local help