I am using Firebird 2.5.1 Embedded. I did the usual to clear a table with almost 200 thousand lines:
delete from SZAFKI
Here's the conclusion, as it takes 16 seconds, which, unfortunately, is unacceptable.
Preparing query: delete from SZAFKI Prepare time: 0.010s PLAN (SZAFKI NATURAL) Executing... Done. 3973416 fetches, 1030917 marks, 116515 reads, 116434 writes. 0 inserts, 0 updates, 182658 deletes, 27 index, 182658 seq. Delta memory: -19688 bytes. SZAFKI: 182658 deletes. 182658 rows affected directly. Total execution time: 16.729s Script execution finished.
Firebird does not have the keyword TRUNCATE. Since the query uses PLAN NATURAL, I tried to execute the query manually, for example:
delete from szafki PLAN (SZAFKI INDEX (SZAFKI_PK))
but Firebird says: "SZAFKI_PK cannot be used in the specified plan" (this is the primary key) Question: how to clean the table efficiently? Falling and recreating is impossible.
Kitet source share