Peter Aronson <pbaronson@...> writes:
> create trigger inter_update before update on my_table
> begin
>    select raise(ignore) where my_function() = 1;
> end;

No, this is the worst approach so far.
This "raise(ignore)" does abort that single update 
of that particular row, but the loop continues.
So, if I called
UPDATE T set C1 = calculation(C2) where C1 is NULL
on 100,000 rows and my_function will begin returning 1 after 10,000 calls,
then my_function will be called 100,000 times and calculation will be called
100,000 times, but only 10,000 rows will be actually updated.
And the time of such semi-aborted update is almost the same 
as time of a single update without any triggers 
(almost 5 seconds, which is close to the timeout time).
But then I will have to call update again, this time it will make 90,000
calls, etc, etc, etc.
The total time is 6 times worse than time of running single update query
without any limits. 



_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to