Skip to content

DF_INDEX_NUMBER_BUFFERS

See Also: Get_Attribute, Set_Attribute

The number of levels to buffer for the index.

Level

Index

Supported by

All Drivers

Type

Numeric, temporary

Access

Read / Write

Values

  • 0 ~ maximum number of buffers allowed by the database

Remarks

DF_INDEX_NUMBER_BUFFERS allows an Embedded Database index to be buffered in memory. This may increase performance on disk read operations. This feature must not be used at any time when the file may be written to. If indices are buffered while another program is writing to the table, records may not be found correctly, save errors may occur, and file relationships may not work.

In addition to setting this attribute explicitly, an index can be buffered via the open command. Specifying an index in the open statement (e.g., Open Customer 2) will use buffering on the specified index.

This attribute is part of the basic set of attributes that must be supported by all drivers. However, it does not make sense in some back ends. DataFlex SQL Drivers will return 0 (zero) for every table accessed; the Pervasive.SQL Driver will return -1 for every table accessed. Trying to set the attribute will be ignored.

Procedure ShowBuffers Handle hTable
    Integer iLastIndex iIndex iNumSegments iNumBuffers
    Get_Attribute DF_FILE_LAST_INDEX_NUMBER Of hTable To iLastIndex
    For iIndex From 1 To iLastIndex
        Get_Attribute DF_INDEX_NUMBER_SEGMENTS Of hTable iIndex To iNumSegments
        If (iNumSegments > 0) Begin
            Get_Attribute DF_INDEX_NUMBER_BUFFERS Of hTable iIndex To iNumBuffers
            Showln "  Index " iIndex ": " iNumBuffers
        End
    Loop
End_Procedure

The sample procedure above shows the number of buffers for every index of the specified table.