I use a binary search.  I have a table with 22,000 records and it's
instantaneous.  My application requires searching by both UPC code and SKU
so I keep an index to go from UPC to SKU.  Even with the index there is no
perceptable delay.

regards,

Dave Mottorn

-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED]]On Behalf Of Laurie
Davis
Sent: Tuesday, March 12, 2002 1:56 PM
To: Palm Developer Forum
Subject: Fast Database Search


Does anyone know of a fast way to search through a very large database
(17000 records)?
I currently use the  the standard approach:

for (UInt16 recordNum = 0; recordNum < DmNumRecords(db); recordNum++)
{
     MemHandle dbRecordHandle = DmQueryRecord(db, recordNum);
     MemPtr dbRecordPtr = MemHandleLock(dbRecordHandle);
     ...  check if data matches search criterion
     MemHandleUnlock(dbRecordHandle);
}

This takes about 20 seconds.

I have successfully used DmFindSortPosition when looking for data that is
sorted, but I
cannot think of any way to speed up the search for other data.

Any ideas?

Laurie



--
For information on using the Palm Developer Forums, or to unsubscribe,
please see http://www.palmos.com/dev/support/forums/



-- 
For information on using the Palm Developer Forums, or to unsubscribe, please see 
http://www.palmos.com/dev/support/forums/

Reply via email to