[sqlite] Re: Copy tables from one memory database to another with no disk access?
Hello, I was thinking about a trick that I once used with an Oracle database. To speed up a data transfer from one database to another, I put the redo log files on a RAM disk. I was severely flamed for this unresponsible suggestion but it made things quicker. Later I learned that there exists also a hidden Oracle parameter to disable logging and get the same speed-up (and crash the system sooner or later). With sqlite :memory: databases things may be different, as a memory database is volatile anyway. Now if you use a regular file database but place this file on a RAM disk, you get a sort of a memory database. It must be less efficient as a true :memory: db, but at least there is no Disk wait time. And: it can be accessed from outside, which is why you might do this. Admittedly, this is a not so straightforward work-around and I would also prefer a solution within Sqlite. But this seems hard to make. Edzard Pasma.
Re: [sqlite] Re: Copy tables from one memory database to another with no disk access?
Igor Tandetnik wrote: Randy Graham <[EMAIL PROTECTED]> wrote: Is it possible to copy tables from one memory database to another without going through an intermediate disk database? Can't you just write a function that would run "select * from table" on one db, and for each record build and execute an insert statement on the other? Using a parameterized prepared statement of course. Igor Tandetnik No, because inserting, say 50,000 records into my file db from my mem db can take 5 minutes or more, even with transactions since my disk flash is so slow. This would make my mem db unavailable for incoming queries/updates during this time which is unacceptable. -Randy
[sqlite] Re: Copy tables from one memory database to another with no disk access?
Randy Graham <[EMAIL PROTECTED]> wrote: Is it possible to copy tables from one memory database to another without going through an intermediate disk database? Can't you just write a function that would run "select * from table" on one db, and for each record build and execute an insert statement on the other? Using a parameterized prepared statement of course. Igor Tandetnik
Re: [sqlite] Re: Copy tables from one memory database to another with no disk access?
Igor Tandetnik wrote: did you try the really obvious way? create table db2.yourtable(...) insert into db2.yourtable select * from db1.yourtable For that to work, one first needs to attach one database to the other. ATTACH command requires a file name. Memory database does not have one. ':MEMORY:' ? -- Craig Morrison =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= http://pse.2cah.com Controlling pseudoephedrine purchases. http://www.mtsprofessional.com/ A Win32 email server that works for You.
Re: [sqlite] Re: Copy tables from one memory database to another with no disk access?
> For that to work, one first needs to attach one database to the other. > ATTACH command requires a file name. Memory database does not have one. It's not ":memory:"? >From the docs: http://sqlite.org/lang_attach.html Syntax of the command: ATTACH DATABASE sql-statement ::= ATTACH [DATABASE] database-filename AS database-name
[sqlite] Re: Copy tables from one memory database to another with no disk access?
Jay Sprenkle wrote: Is it possible to copy tables from one memory database to another without going through an intermediate disk database? did you try the really obvious way? create table db2.yourtable(...) insert into db2.yourtable select * from db1.yourtable For that to work, one first needs to attach one database to the other. ATTACH command requires a file name. Memory database does not have one. Igor Tandetnik