Subject Empty table optimization
Author tomjanczkadao
Hi
what is the fastest way to empty table?
DELETE FROM TABLE seems to be slow, it generates lot of non-indexed reads from table.

I did some tests.
In a loop (10000x) I do
"insert into table " (1 row);
"delete from table" (1 row);

It takes about a minute. when I add "where pk_field = :loop_iterator" to delete statement, it takes less than second!
My original case is more complicated. For each result of main FOR SELECT loop i do few inserts, do some calculations on inserted values and finally delete all records used for calculations. And that final delete seems to be weakest link. I see no way to use index like test example above.

Regards, Tomek