Please enable JavaScript to view this site.

R:BASE 11 Help

Navigation: Reference Index > Indexes

Using Index-Only Retrieval

Scroll Prev Top Next More

If it can, R:BASE will do an index-only retrieval. This is the fastest method of retrieving data. When the columns selected for display are limited to the column or columns in the index used in the WHERE clause, R:BASE will retrieve the data as it reads the index information from file 3. It does not need to look at the data stored in file 2. Index-only retrieval is done only when the columns to be retrieved are all included in the index. If the table is small, however, index-only retrieval may not be faster. As a rule of thumb, R:BASE will choose index-only retrieval if the length of the index columns is less than 50% ofthe row length (in bytes). If the table is small (not many columns), other retrieval methods are usually faster than index-only.

 

The SELECT COUNT(*) command uses index-only retrieval if there is an indexed column in the table. Instead, use a SELECT COUNT(colname) command, where the column specified in the command is not an indexed column, and the column has a value for every row. If the column is indexed, R:BASE will use index-only retrieval. If the column contains nulls, those rows are not counted. Do not use this command to check for broken pointers or to compare performance with other commands.