Subject Re: Trouble using Datapump in a long delete to drive a progress bar
Author Svein Erling Tysvær
Hi Chuck!

You do not mention which version of InterBase/Firebird you're using,
my advice will at least help if it is an old version and MasterLibrary
is a largeish table. Change ModData.crDPAnyUse this way:

with ModData.crDPAnyUse do
begin
SQL.Clear;
SQL.Add('SELECT cv_id From CUSTOM_VIEW ');
SQL.Add('Where NOT EXISTS(SELECT * FROM MasterLibrary ');
SQL.Add('WHERE MasterLibrary.ml_id = CUSTOM_VIEW.ml_id) ');
SQL.Add('ORDER BY CV_ID ');
end;

Your problem may well be elsewhere, but I'm not capable of telling
where. I'm surprised that you do a RecordCount, I'd expect that to
take the same time as simply

DELETE From CUSTOM_VIEW
Where NOT EXISTS(SELECT * FROM MasterLibrary
WHERE MasterLibrary.ml_id = CUSTOM_VIEW.ml_id)

And it cannot be worth waiting equally long getting the progress bar
to show as to do the entire delete?

HTH,
Set