#1 2013-10-10 07:44:11

noobies
Member
Registered: 2011-09-13
Posts: 139

Fastest way to delete from a large table

dont see drop table method, current realization

Database.EngineExecute('delete from Products');
VacuumBase;


procedure VacuumBase;
begin
  with TSQLRestClientDB(Database).Server do begin
    DB.Lock('');
    try
      EngineExecuteAll('VACUUM');
    finally
      DB.UnLock;
    end;
  end;
end;

but i think drop table and recreate table more faster?

Offline

#2 2013-10-10 09:49:04

ab
Administrator
From: France
Registered: 2010-06-21
Posts: 14,240
Website

Re: Fastest way to delete from a large table

Yes, DELETE FROM PRODUCT is the best way by now.

About VACUUM be aware that in some cases it is a no-op when called via a TSQLRestClientDB/TSQLRestServerDB.
This is due to virtual tables injection within an opened database.

The same restriction as with Backup applies here: you should better work at SQLite3 level, i.e. calling directly the DB engine.

Offline

Board footer

Powered by FluxBB