Subject Re: [firebird-support] Fast massive delete with complex criteria
Author Milan Babuskov
Josef Kokeš wrote:
> 1) Am I overlooking some possible fast approach?

You could create a view named the same as your table and use it to
"mask" the table for the rest of application(s). This would save you
from inserting records twice. Let's assume your table is named DATA,
these would be the steps:

1. create table data_2 ( ... same DDL as data );
2. insert into data_2 select rows you need from data
3. drop table data;
4. create view data as select * from data_2;

Next time:

1. create table data_3 (... sam DDL );
2. insert into data_3 select rows you need from data_2;
3. drop view data;
4. create view data as select * from data_3;
5. [optional] drop table data_2;


> 2) Do you think c has a reasonable chance of being the fastest?

c is the fastest.

Make sure you use at least Firebird 2.1 because earlier versions do not
optimize queries on views very well.

--
Milan Babuskov

==================================
The easiest way to import XML, CSV
and textual files into Firebird:
http://www.guacosoft.com/xmlwizard
==================================