Subject | Slow Update |
---|---|
Author | Maxisoft - Luciano Enzweiler |
Post date | 2005-12-05T23:03:48Z |
Hi.
I made an update SQL but it takes too much time to execute, and there seem to be no reason for that.
The update is like this one:
The field T1.CODTB is the Primary Key of TABLE1 and all the other fields are integers, but none is indexed. Both tables have about 2000 records.
update TABLE1 T1 set T1.MARCA = 0 where (T1.MARCA = 1) and (T1.CODTB not in (select T2.CODREF from TABLE2 T2 where (T2.CODREF is not null) and (T2.FILTRO = 1)))
The Execution Time of the SQL above is more than 20 seconds!!
If I break the select and the update, each of them takes zero or 0.001 second to execute. I made the select of TABLE2 retrive only two records, 1 and 2. So I executed both SQLs separatedely:
update TABLE1 T1 set T1.MARCA = 0 where (T1.MARCA = 1) and (T1.CODTB not in (1, 2))
and
select T2.CODREF from TABLE2 T2 where (T2.CODREF is not null) and (T2.FILTRO = 1)
As I said, they execute instantly. Am I doing something wrong or is it expected?
I'm running Firebird 1.5.0.4306 on Windows XP SP2.
Thanks for any help.
Luciano Enzweiler.
[Non-text portions of this message have been removed]
I made an update SQL but it takes too much time to execute, and there seem to be no reason for that.
The update is like this one:
The field T1.CODTB is the Primary Key of TABLE1 and all the other fields are integers, but none is indexed. Both tables have about 2000 records.
update TABLE1 T1 set T1.MARCA = 0 where (T1.MARCA = 1) and (T1.CODTB not in (select T2.CODREF from TABLE2 T2 where (T2.CODREF is not null) and (T2.FILTRO = 1)))
The Execution Time of the SQL above is more than 20 seconds!!
If I break the select and the update, each of them takes zero or 0.001 second to execute. I made the select of TABLE2 retrive only two records, 1 and 2. So I executed both SQLs separatedely:
update TABLE1 T1 set T1.MARCA = 0 where (T1.MARCA = 1) and (T1.CODTB not in (1, 2))
and
select T2.CODREF from TABLE2 T2 where (T2.CODREF is not null) and (T2.FILTRO = 1)
As I said, they execute instantly. Am I doing something wrong or is it expected?
I'm running Firebird 1.5.0.4306 on Windows XP SP2.
Thanks for any help.
Luciano Enzweiler.
[Non-text portions of this message have been removed]