I think that there are a number of issues here.  If I may summarize and
paraphrase Prashant's questions:

1) What are the technical limits on a PDB file?
2) What are the practical limits on a PDB file?
3) What are the technical limits on a Palm OS database?
4) What are the practical limits on a Palm OS database?

Here are my takes on the answers:

1) What are the technical limits on a PDB file?
======================================================================

The technical limit is kind of tricky, if you want to express the answer in
terms of number of records and record size.  The chief limiting factor in the
PDB file format is the offset used to locate each record.  This is a 32-bit
value -- an offset from the beginning of the file.  So no PDB file can be larger
than 4GB.

How many records you can squeeze into that file depends on a number of factors.
Naturally, the smaller each record is, the more you can have in the PDB file.
However, there is an overhead of 10 bytes per record, so the maximum number of
record you can have is along the lines of 4GB / 8 bytes == 512 million records,
assuming each record was zero bytes long.

Note, here, that there is nothing limiting a record to 64K.


2) What are the practical limits on a PDB file?
======================================================================

As Prashant noted in his first e-mail, the offsets to each record in the file
are stored in a list.  This list has a header that contains the number of
offsets in the list.  This number is stored in a 16-bit field, limiting the
number of offsets in the list to 64K.

As Danny noted, there is another field in the header that can link to another
offset list in the file.  Thus, you can break the 64K limit by adding new record
offset lists.  HOWEVER, not all PDB manipulating applications handle this link.
I know that the Palm OS Emulator doesn't.  So far, it hasn't been an issue.

But there is another limitation here.  Each database record has an associated
unique ID value.  This unique ID is 24-bit long.  Since you want each record
have a unique unique ID, you can have at most 16 million records.


3) What are the technical limits on a Palm OS database?
======================================================================

The in-memory format of a Palm OS database is similar to what is found in a PDB
file.  A PDB file is pretty much a flattened representation of the database.
Thus, the limiting factor is the 32-bit LocalID and the 24-bit unique ID.


4) What are the practical limits on a Palm OS database?
======================================================================

And now we get back to Prashant's original question.  What good are all these
large values if functions like DmRecordInfo, DmRemoveRecord, DmDeleteRecord,
etc., take an UInt16 as an index parameter.  This, I feel, is the real limit to
the number of records in a Palm OS database -- 64K records.  In fact, some Data
Manager routines (such as the sorting routines), use Int16's internally as
indexes, further limiting the number of records to 32K.  Naturally, that last
limit is hidden from the API and so can be changed without breaking
applications, but it is a limit that some applications need to be aware of.

Also keep in mind another practical limit to the number of records: HotSync
speed.  As people here have noted (and so this is hearsay, as I have no direct
experience with this), HotSync speed is often largely dependent on the number of
records: the more records, the longer the HotSync.  HotSyncing 10,000 records
each 10 bytes long will take much longer than HotSyncing 10 records each 10,000
bytes long.

Those are the limiting factors when determining the number of records in a
database.  However, the Memory Manager also imposes a limit on the maximum size
of each record.  As Danny said, memory chunks are limited to just under 64K, and
so no record can be larger than that.  But as it turns out, this limit is
artificial.  There's nothing in the current Memory Manager that says that chunks
have to be limited to 64K.  The reason why that limit is there is because the
HotSync protocol can't transfer blocks larger than that.  If that restriction is
ever removed, then the limit in the Memory Manager may be removed.


-- Keith Rollin
-- Palm OS Emulator engineer






Steve Mann <[EMAIL PROTECTED]> on 11/08/2000 10:06:55 PM

Please respond to "Palm Developer Forum" <[EMAIL PROTECTED]>

Sent by:  Steve Mann <[EMAIL PROTECTED]>


To:   "Palm Developer Forum" <[EMAIL PROTECTED]>
cc:    (Keith Rollin/US/PALM)
Subject:  Re: Nondeliverable mail



>1 )  Correct me if I am wrong, but this implies that the maximum number
>      of  records  in  a  PDB can be 65536 with each having 64KB of data.
>      i.e. 65536 * 65536 bytes of maximum storage per database ?

Yes.

Regards,
Steve Mann






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

Reply via email to