Thanks a lot for the reply.
The TABLE_TEST has the TIME field as the primary key. So its automatically indexed. The table has some 200000 records.
I will try splitting the or clause.
I will try the modified query you have given again a lot of thanks.
update TABLE_TEST set TIME = 1064929834 where (TIME is NULL or 1064929834 - TIME >= 10) and (1064929834 - SADT >= 0) and 1064929834 not in (select TIME from TABLE_TEST where TIME is not NULL)
update TABLE_TEST set TIME = 1064929834
where (TIME is NULL or 1064929834 - TIME >= 10)
and (1064929834 - SADT >= 0)
and 1064929834 not in (select TIME from TABLE_TEST where TIME=1064929834)
I tried it and found that it doesnot give a quicker time.
So what other methods can be applied to optimize it ?
How exectly the exists clause can be applied ? would it be faster ?
The table has another field as primary key and it doesnot appear in the clause.The time field is a general field and not indexed.Since i have a primary key(though other than the fielsd involved in the query) i think it
is automatically indexed according to its PK.
So what should i do to run it faster ?
Waiting for your reply and thanking for your help,
Then create an index on time (see create index in your sql manual) and analyze it afterwards then the query I suggested should be much quicker as it doesnt have to do a full table scan. Also try not exists for the subquery as that might help aswell.