[sqlite] SQLite - Database disk size difference when tables copied

2012-08-23 Thread Madhur Kashyap
Hello Pavel,

> >* When I implement the same mechanism for saving the*> >* memory database 
> >back to disk, the size of disk file is 4x of the original*> >* disk file 
> >size.*
> What is "original disk file size" here? Is it an empty database,
> database with some data, database with exactly the same data you are
> restoring? If the latter then do you restore right over the existing
> data? If yes how?


The original database on disk was created from scratch in memory and saved
"backup" command in regular "tclsh". Afterwards it was restored using
CREATE TABLE in the EDA tool as mentioned below

dbcmd eval "CREATE TABLE '$tname' AS SELECT * FROM loadfrom.'$tname'"

Once it is restored in the EDA tool memory, it is saved back on disk using
the commands I mentioned in the first email.

Thanks,
Madhur
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] SQLite - Database disk size difference when tables copied

2012-08-22 Thread Pavel Ivanov
> When I implement the same mechanism for saving the
> memory database back to disk, the size of disk file is 4x of the original
> disk file size.

What is "original disk file size" here? Is it an empty database,
database with some data, database with exactly the same data you are
restoring? If the latter then do you restore right over the existing
data? If yes how?

Pavel


On Wed, Aug 22, 2012 at 10:00 PM, Madhur Kashyap
 wrote:
> Hello,
>
> I am using Tcl Extension (TEA) of SQLite inside an EDA tool which supports
> TCL User Shell. I have a strange problem that SQLite version 3.7.10 is
> downgraded to 3.5.9 when I load the necessary .so files. Due to this change
> the backup and restore commands are probably causing a core dump in the EDA
> tool execution.
>
> I have to implement save and restore capability for the memory database
> used in the application. Restore I have implemented using traditional
> method to first attach the disk database and then copy all tables listed in
> sqlite_master table. When I implement the same mechanism for saving the
> memory database back to disk, the size of disk file is 4x of the original
> disk file size.
>
> What is the reason for this size increase? What can I do to avoid this file
> size increase? A long pending question - Why the version is getting
> downgraded to 3.5.9 ? The Tcl version is 8.4.x within the EDA tool. Also I
> cannot find any SQLite libraries within the tool installation.
>
> dbcmd eval "ATTACH DATABASE 'test_disk.db' AS copyto"
> set tableNames [ dbcmd eval {SELECT name FROM sqlite_master WHERE type
> = 'table'} ]
> foreach tname $tableNames {
> dbcmd eval "CREATE TABLE copyto.$tname AS SELECT * FROM $tname"
> }
>
> --
> Regards
> Madhur Kashyap
> ___
> sqlite-users mailing list
> sqlite-users@sqlite.org
> http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


[sqlite] SQLite - Database disk size difference when tables copied

2012-08-22 Thread Madhur Kashyap
Hello,

I am using Tcl Extension (TEA) of SQLite inside an EDA tool which supports
TCL User Shell. I have a strange problem that SQLite version 3.7.10 is
downgraded to 3.5.9 when I load the necessary .so files. Due to this change
the backup and restore commands are probably causing a core dump in the EDA
tool execution.

I have to implement save and restore capability for the memory database
used in the application. Restore I have implemented using traditional
method to first attach the disk database and then copy all tables listed in
sqlite_master table. When I implement the same mechanism for saving the
memory database back to disk, the size of disk file is 4x of the original
disk file size.

What is the reason for this size increase? What can I do to avoid this file
size increase? A long pending question - Why the version is getting
downgraded to 3.5.9 ? The Tcl version is 8.4.x within the EDA tool. Also I
cannot find any SQLite libraries within the tool installation.

dbcmd eval "ATTACH DATABASE 'test_disk.db' AS copyto"
set tableNames [ dbcmd eval {SELECT name FROM sqlite_master WHERE type
= 'table'} ]
foreach tname $tableNames {
dbcmd eval "CREATE TABLE copyto.$tname AS SELECT * FROM $tname"
}

-- 
Regards
Madhur Kashyap
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users