Greetings.

I have a slow response problem... This command, used in conjunction with an another much bigger attached DB (client),

BEGIN;
 INSERT OR REPLACE INTO LSOpenProjects
   SELECT * FROM client.LSOpenProjects as A
     WHERE id IN
     (
       SELECT id from LSOpenProjects
         WHERE login != 'user1' AND Date != A.Date
     );
END;

is about 20 slower than if I follow this two step process:

Step 1: prepare and execute this command,
   SELECT id,Date FROM LSOpenProjects WHERE login != 'user1';

Step 2: Use the result from that SELECT to create a set of INSERTS like this (say that the result provides 20 ids and Dates), I build a huge statement like this one...

BEGIN;
   INSERT OR REPLACE INTO LSOpenProjects
SELECT * FROM client.LSOpenProjects WHERE id = 1 AND Date != A.Date;
   INSERT OR REPLACE INTO LSOpenProjects
SELECT * FROM client.LSOpenProjects WHERE id = 2 AND Date != A.Date;
...
...
   INSERT OR REPLACE INTO LSOpenProjects
SELECT * FROM client.LSOpenProjects WHERE id = 19 AND Date != A.Date;

   INSERT OR REPLACE INTO LSOpenProjects
SELECT * FROM client.LSOpenProjects WHERE id = 20 AND Date != A.Date;
END;

Both DBs have indexes on id, Date, ProjID, code and login.

Any thoughts?  Thanks.

josé

_______________________________________________
sqlite-users mailing list
[email protected]
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to