Attempting to merge large databases

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Attempting to merge large databases

Gene Allen
I have several databases files that I need to “merge”.  Each one has the
same schema and about ½ million records.

 

Here is what I’m currently doing (but in code)

 

C:\Development\Main\Common\SQLite>sqlite3 c:\test\a.db3

SQLite version 3.2.7

Enter ".help" for instructions

sqlite> attach 'c:\test\b.db3' as toMerge;          

sqlite> insert into AuditRecords select * from toMerge.AuditRecords;

sqlite> detach database toMerge;

 

Is there a faster/better way to do this?  Should I wrap the insert in a
transaction or something?

 

Thanks a lot,

 

Gene

_______________________________________________
sqlite-users mailing list
[hidden email]
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
Reply | Threaded
Open this post in threaded view
|

Re: Attempting to merge large databases

John McMahon-2
Gene Allen wrote:
[SNIP]

> Enter ".help" for instructions
>
> sqlite> attach 'c:\test\b.db3' as toMerge;          
>
try this:

BEGIN;
> sqlite> insert into AuditRecords select * from toMerge.AuditRecords;
COMMIT;
>
> sqlite> detach database toMerge;
>
John

--
Regards
    John McMahon
       [hidden email]


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