In RDBMSs other than DBFs, indexes are not used for Navigation or for Seeks.
The purpose of indexes is only to optimize where clauses for queries.
Intelligent planning of indexes is an essential part of database design to optimize queries in OLAP (Online Analytical processing).
For the size of data tables most of use, no indexes are ever necessary. We need to think about them when we are dealing with multi-million records tables.
Now, as for Seek.
If you are using FWMariaDB for MySql or MariaDB, this works with single field.
Note: No indexes need to be build. Creating indexes is an unnecessary overhead.
- Code: Select all Expand view RUN
oRs:SetOrder( "fieldname" )
oRs:Seek( uValue )
OR
- Code: Select all Expand view RUN
oRs:SetOrder( "CITY ASC,SALARY DESC" ) // multicol sort
oRs:Seek( cValue ) // works only for first field. i.e., CITY
Now, your requirement is to seek on multi-field values.
We advise you to use oRs:Locate()
- Code: Select all Expand view RUN
oRs:Locate( "CITY = 'N' .AND. AGE > 40" )
// for locating next
oRs:Locate( "CITY = 'N' .AND. AGE > 40",, .T. )
Note: With FWMariaDB, all sorting, seeking and locating are done in memory. Database is not acccessed or queried. Therefore these operations are very fast.