SQLite Forum

Is there a way to optimize this UPDATE command to run faster?
Login
Hello, 

Assuming I have the following table:

<code>
 CREATE TABLE SnapshotParameters(
     snapshot_id   integer,
     object_id     integer,
     param_id      integer,
     param_value   integer
 );
 </code>


This table contains about 24K records per one snapshot.<br>
Assuming I want to copy values from one snapshot to the other and using the following command:

<code>
UPDATE	SnapshotParameters AS dst
            SET     	param_value=src.param_value FROM SnapshotParameters AS src
            WHERE	dst.object_id==src.object_id  AND
                        dst.param_id==src.param_id    AND
                        dst.snapshot_id==3            AND
                        src.snapshot_id==5;
</code>
				
This command works fine but the problem is that it takes ~3.5 seconds to complete.

Is there a way to optimize this UPDATE command to run faster?

Many thanks,

PazO