Subject Re: [Firebird-Architect] the insert into t select * from t infinite
Author Arno Brinkman

> Here's a particularly nasty query (at least I think it is)

> delete from t t1
> where in (select first 5 t t2
> from t order by;


> If we applied the logic I described above (assuming it can be applied)
> here's what happens. Still assuming an index on, the engine starts
> reading the index and finds that the first five entries are all valid,
> and that the first one matches the value of from the outer loop so
> that record is deleted. It gets the next value of and goes to the
> index to find the first 5 records. The first record appears, at first
> glance, to be deleted, but it is also on the undo list for the delete.
> The engine goes to the previous version of that record, finds that it is
> legitimate for the current transaction, and keeps it in the list of 5.
> Again, the non-indexed case has the same behavior at greater cost.

What is the list of 5?
What happends when the statement is executed twice in the same transaction? Are 5 or 10 records

Arno Brinkman

Firebird open source database (based on IB-OE) with many SQL-99 features :

Support list for Interbase and Firebird users :

Nederlandse firebird nieuwsgroep :