Re: [sqlite] VACUUM command not working
Thank you so much Richard. I have tried WAL and then applied VACUUM, it is working fine. Thanks again, Tarun Thakur On 8/19/11, Richard Hipp wrote: > On Thu, Aug 18, 2011 at 11:19 PM, Tarun wrote: > >> Hi All, >> >> I am running program in which I have created SQLite DB file using: >> >> sqlite3async_initialize() >> > > The easiest solution to your problem might be simply to not use the > test_async.c module. That module was created long ago to work around issues > with fsync(). These days, using "PRAGMA journal_mode=WAL" does a better job > of overcoming the same issue. > > So I suggest that you drop the test_async.c module and instead enable > "PRAGMA journal_mode=WAL". See if that doesn't work out better for you. > And if not, we'll take up the problem from that point > > >> sqlite3_open_v2() >> >> Then created one table into SQLiteDB by using sqlite3_exec() in which >> I passed SQL command of creating table. >> >> Then I inserted records into table using INSERT sql command in >> sqlite3_exec() >> >> Then I did sqlite3async_run() to commit all write request from >> pending queue to SQLite DB file on disk. >> >> Then I did deletion of records from table using DELETE sql query in >> sqlite3_exec() >> >> Then I ran VACUUM command this way: >> >> sql = "VACUUM;"; >> rc = sqlite3_exec(asyncsql.pdb, sql, NULL, 0, &zErrMsg); >> >> >> >> After successful running of above command I checked size of my >> SQLiteDB file using system ("ls -lrt"); >> >> NOTE: No compilations issue. async IO code file and sqlite shared >> library linked properly. All sqlite3_exec() ran successfully with >> SQLITE_OK, no error code returned. >> >> Given below is output shown: >> >> [tarun@emu async_prg]$ ./sqlite_async_compKey vacum1.db 1000 >> >> 1313661267 1313661269 1313661316 >> system1-> Size of file after records insertion >> -rw-r--r--. 1 tarun tarun 559104 Aug 18 15:25 vacum1.db >> >> system2 -> Size of file after records deletion >> -rw-r--r--. 1 tarun tarun 559104 Aug 18 15:25 vacum1.db >> >> VACUUM SQLite API SUCCESS >> system3 -> Size of file after VACUUM command >> -rw-r--r--. 1 tarun tarun 559104 Aug 18 15:25 vacum1.db >> >> My problem is why SQLiteDB file size is not reduced after VACUUM has >> been run. Please help to get VACUUM running in my case. >> It would be really helpful if anyone can share working demo program >> using VACUUM. >> Waiting for your response, I am stuck in my work. >> -- >> Thanks and Regards, >> - Tarun Thakur >> Module Lead >> NEC HCL System Technologies, Noida >> www.nechclst.in >> ___ >> sqlite-users mailing list >> sqlite-users@sqlite.org >> http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users >> > > > > -- > D. Richard Hipp > d...@sqlite.org > ___ > sqlite-users mailing list > sqlite-users@sqlite.org > http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users > -- Regards, - Tarun Thakur Module Lead NEC HCL System Technologies, Noida www.nechclst.in ___ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
Re: [sqlite] VACUUM command not working
On Thu, Aug 18, 2011 at 11:19 PM, Tarun wrote: > Hi All, > > I am running program in which I have created SQLite DB file using: > > sqlite3async_initialize() > The easiest solution to your problem might be simply to not use the test_async.c module. That module was created long ago to work around issues with fsync(). These days, using "PRAGMA journal_mode=WAL" does a better job of overcoming the same issue. So I suggest that you drop the test_async.c module and instead enable "PRAGMA journal_mode=WAL". See if that doesn't work out better for you. And if not, we'll take up the problem from that point > sqlite3_open_v2() > > Then created one table into SQLiteDB by using sqlite3_exec() in which > I passed SQL command of creating table. > > Then I inserted records into table using INSERT sql command in > sqlite3_exec() > > Then I did sqlite3async_run() to commit all write request from > pending queue to SQLite DB file on disk. > > Then I did deletion of records from table using DELETE sql query in > sqlite3_exec() > > Then I ran VACUUM command this way: > > sql = "VACUUM;"; > rc = sqlite3_exec(asyncsql.pdb, sql, NULL, 0, &zErrMsg); > > > > After successful running of above command I checked size of my > SQLiteDB file using system ("ls -lrt"); > > NOTE: No compilations issue. async IO code file and sqlite shared > library linked properly. All sqlite3_exec() ran successfully with > SQLITE_OK, no error code returned. > > Given below is output shown: > > [tarun@emu async_prg]$ ./sqlite_async_compKey vacum1.db 1000 > > 1313661267 1313661269 1313661316 > system1-> Size of file after records insertion > -rw-r--r--. 1 tarun tarun 559104 Aug 18 15:25 vacum1.db > > system2 -> Size of file after records deletion > -rw-r--r--. 1 tarun tarun 559104 Aug 18 15:25 vacum1.db > > VACUUM SQLite API SUCCESS > system3 -> Size of file after VACUUM command > -rw-r--r--. 1 tarun tarun 559104 Aug 18 15:25 vacum1.db > > My problem is why SQLiteDB file size is not reduced after VACUUM has > been run. Please help to get VACUUM running in my case. > It would be really helpful if anyone can share working demo program > using VACUUM. > Waiting for your response, I am stuck in my work. > -- > Thanks and Regards, > - Tarun Thakur > Module Lead > NEC HCL System Technologies, Noida > www.nechclst.in > ___ > sqlite-users mailing list > sqlite-users@sqlite.org > http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users > -- D. Richard Hipp d...@sqlite.org ___ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
[sqlite] VACUUM command not working
Hi All, I am running program in which I have created SQLite DB file using: sqlite3async_initialize() sqlite3_open_v2() Then created one table into SQLiteDB by using sqlite3_exec() in which I passed SQL command of creating table. Then I inserted records into table using INSERT sql command in sqlite3_exec() Then I did sqlite3async_run() to commit all write request from pending queue to SQLite DB file on disk. Then I did deletion of records from table using DELETE sql query in sqlite3_exec() Then I ran VACUUM command this way: sql = "VACUUM;"; rc = sqlite3_exec(asyncsql.pdb, sql, NULL, 0, &zErrMsg); After successful running of above command I checked size of my SQLiteDB file using system ("ls -lrt"); NOTE: No compilations issue. async IO code file and sqlite shared library linked properly. All sqlite3_exec() ran successfully with SQLITE_OK, no error code returned. Given below is output shown: [tarun@emu async_prg]$ ./sqlite_async_compKey vacum1.db 1000 1313661267 1313661269 1313661316 system1-> Size of file after records insertion -rw-r--r--. 1 tarun tarun 559104 Aug 18 15:25 vacum1.db system2 -> Size of file after records deletion -rw-r--r--. 1 tarun tarun 559104 Aug 18 15:25 vacum1.db VACUUM SQLite API SUCCESS system3 -> Size of file after VACUUM command -rw-r--r--. 1 tarun tarun 559104 Aug 18 15:25 vacum1.db My problem is why SQLiteDB file size is not reduced after VACUUM has been run. Please help to get VACUUM running in my case. It would be really helpful if anyone can share working demo program using VACUUM. Waiting for your response, I am stuck in my work. -- Thanks and Regards, - Tarun Thakur Module Lead NEC HCL System Technologies, Noida www.nechclst.in ___ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users