|
|
|
|
|
- Use conditions
- Automatic reindexing
- "Zero-downtime" reindexing
- Calculating statistics
- Directory of temporary files
- Managing non-Latin character sets
- Access rights to the data file
- Special case: Files corrupted after a computer reboot or a fatal error
HIndex (Function) In french: HRéindexe
Available only with these kinds of connection
Rebuilds the file index (".NDX" file). You can also reindex: - full-text indexes (".FTX" files),
- spatial indexes (".SDX" files).
A data file can be reindexed even when it is accessed by applications. For more details, see remarks. Reminder: Reindexing reorganizes indexes and can free up space left when records are deleted. After the reindex operation, the access to indexes is optimized. Reindexing a data file can become necessary further to the loss or modification of the index file. HCheckIndex is used to regularly check the status of the index file.
IF HIndex(AFile, hNdxNormal) = True THEN
TableDisplay(TABLE_MyTable, taStart)
END
Syntax
<Result> = HIndex([<Data file> [, <Mode> [, <Progress Bar> [, <Density rate>]]]])
<Result>: Boolean - True if the reindex operation was successfully performed,
- False otherwise. HError returns more details about the problem.
<Data file>: Optional character string Name of the data file used. If this name is not specified, HIndex will use the last data file used by the last HFSQL function (function starting with "H"). <Mode>: Optional Integer constant (or combination of constants) Configure the reindex operation: | | hChangeCharset | Reindexing with change of character set. The new character set defined by ChangeCharset will be taken into account during the reindexing. Sorts, searches, ... on string keys (strings, characters, date and time) will be performed according to this character set. | hFTX | Reindexing of full-text indexes. | hMmoCompact | Compression and defragmentation of "Mmo" files.
Caution: This constant cannot be combined with the hNdxCompact, hCheckMemo, hFTX, hSDX, hNdxNormal or hNdxDelete constants. | hNdxCompact | Reindexing with compression: only active records are kept. All the other records are permanently deleted. The space left by the deleted records is deleted from the data file and the index (".FIC" and ".NDX" files, respectively). Remark: If one or more records are in a transaction, compression is automatically disabled. | hNdxMinimal | Reindexing while taking into account only corrupted keys. This parameter is ignored if the hNdxDelete or hNdxCompact constant is enabled. | hNdxSilent | Reindexing without display. | hNdxNormal (default value) | Standard reindexing (with statistics and without compression). The statistics are used to optimize the queries and the filters (see the Notes). Only active records are taken into account for calculating statistics. | hNdxNoStat | Reindex without calculating statistics. This constant increases the available space by reducing the size of index files. Caution: The statistics are very important to get correct execution times when using queries, filters with condition and views with condition. | hNdxDelete | Reindex and delete damaged records. | hSDX | Reindexing of spatial indexes. | hBackgroundTask | | hCheckMemo | Standard reindexing with memo check and correction if necessary (used to retrieve the damaged memos). |
<Progress Bar>: Optional control or window name, or optional integer - Name of the window in which the progress bar will be displayed,
- Name of the Progress Bar control that displays the reindexing progress,
- Handle of the window that displays the progress bar.
<Density rate>: Integer included between 1 and 100 Density rate of indexes. This rate is set to 60 by default. The higher this rate is, the denser and smaller the index is. In this case, iterations, searches, filters and queries will be faster. The additions of records and the modifications of records may be slower. The smallest this rate is, the less dense and the bigger the index will be. In this case, iterations, searches, filters and queries will be slower. The additions of records and the modifications of records will be faster. Caution: this parameter can only be used on the data files in HFSQL format.
Remarks Use conditions - HIndex reindexes an xBase file.
- HIndex reindexes the files of a cluster. In this case:
- The reindex operation is performed on the node to which the user is connected.
- Only a zero-downtime reindexing is available (hBackgroundTask constant).
Calculating statistics Statistics are used to optimize the queries and filters on the data file. Only active records are taken into account for these statistics. HStatCalculate also returns the results of this calculation. Remark: To efficiently calculate statistics, all data files must be included. This is the case of a multi-file query, for example. Directory of temporary files Temporary files can be created during the reindex operation. By default, these files are created in the Windows temporary directory or in the current directory if there is not enough space. The H.TemporaryDirectory variable allows you to configure the directory used to save these temporary files. This variable is recommended when reindexing large data files.
Access rights to the data file The reindex operation provokes the recreation of the data file on disk. In an allocation system that manages permissions at file level (NTFS, etc.), the reindexed data file will have the permissions of the directory to which it belongs. Before the reindex operation, if the data file had specific rights different from the rights of the folder, they must be redefined in Windows after the reindex operation. Special case: Files corrupted after a computer reboot or a fatal error The data files may be corrupted when the computer is unexpectedly rebooted. In this case, the data files contain invalid data (unreadable characters for example). To fix this problem: - Perform a reindexing with deletion.
- Free the records in transaction with HTransactionFree.
- Delete the incorrect records with WDMAP.
Business / UI classification: Business Logic
This page is also available for…
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|