Subject Re: [firebird-support] FB1.5.2 100 % CPU
Author Ann W. Harrison
nagypapi wrote:
>
> The following sql statement worked perfectly in a few seconds, and
> gave back 1 result:
> select min(id) from zaras_futar_forgalmak where datum in
> (select datum from zaras_futar_forgalmak group by datum
> having count(distinct id)>1)
>
> but the following caused a 100% CPU load:
> delete from zaras_futar_forgalmak where id in
> (select min(id) from zaras_futar_forgalmak where datum in
> (select datum from zaras_futar_forgalmak group by datum
> having count(distinct id)>1)
> )
>
> The table has approximately 2000-5000 records
>
> I waited a few minutes, but it didn't finish, should I have waited more?
>

Probably. The delete is going to run the subquery 2000-5000 times,
and what was quick when you do it once may seem pretty slow when
you do it several thousand times.


Regards,


Ann