Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Packing/Speeding up Paradox tables

0 views
Skip to first unread message

Bennie Coetzer

unread,
Mar 19, 1998, 3:00:00 AM3/19/98
to

Hi,
Can anyone please explain the mechanism by which Paradox re-uses space
when records are deleted. After several enquiries on the forum I came
to the conclusion that Paradox tables re-use empty records. Also it
seems as though no pack command exists. I have a table which
automatically gets loaded with fields and blob images of varying sizes.
These get stored in a *.MB file. AFter clearing records the size of
these files stay the same. Sooner or later the disk will be full and I
will have to delete older records, yet deleting them does not give me
more disk space. I can manually pack the table using the Restructure
utility which does result in the desired effect but I need an automatic
mechanism.

My second problem is the speed with which these records are added to the
table. ARe there any special techniques to improve on the loading
speed, especially the blob fields. Currently I use a
LoadFromFile/SaveToFile property but this seems very inefficient. Some
help will be appreciated.

Bennie

Paul Munn

unread,
Mar 19, 1998, 3:00:00 AM3/19/98
to

Borland supplies some paradox-related programs and information at
http://www.borland.com/devsupport/bde/delphifiles.html

Bennie Coetzer wrote in message <351205...@thales.co.za>...
[...]


>more disk space. I can manually pack the table using the Restructure
>utility which does result in the desired effect but I need an automatic
>mechanism.

[...]
>Bennie

Bill Todd (TeamB)

unread,
Mar 19, 1998, 3:00:00 AM3/19/98
to

If you really want to understand Paradox tables read Dan Ehrmann's five part
series that ran last year in Delphi Informant.

The primary index of a Paradox table is a clustered index. If you delete a
record the space occupied by that record is now available. If you add a new
record and the primary key value of the new record causes it to reside in
the same block that has free space from a previously deleted record that
free space will be used for the new record. If you delete records with
random primary keys and add records with random primary keys your database
will grow to a point where most of the blocks have some free space and from
then on growth will be very slow because most new records will find existing
space to reuse.

To pack a Paradox table use the following.

function dgPackParadoxTable(Tbl: TTable; Db: TDatabase):DBIResult;
{Packs a Paradox table by calling the BDE
DbiDoRestruct function. The TTable passed as the
first parameter must be closed. The TDatabase passed
as the second parameter must be connected.}
var
TblDesc: CRTblDesc;
begin
Result := DBIERR_NA;
FillChar(TblDesc, SizeOf(CRTblDesc), 0);
StrPCopy(TblDesc.szTblName, Tbl.TableName);
TblDesc.bPack := True;
Result := DbiDoRestructure(Db.Handle, 1, @TblDesc, nil, nil, nil, False);
end;


--
Bill

(TeamB cannot answer questions received via email.)
(To contact me for any other reason remove nospam from my address)


0 new messages