last day (14 days later) » 

11:29 AM
1
A: SQLite databse size getting increase

axierjhtjzYou can enable auto_vacuum and upgrade the bbdd. If you sync your data with a webservice or something like that you shouldn't have any problem. If you can't lose the data then try this: Remove the last ";" from the command. I know it might sound stupid but all the info I´ve recovered about vacu...

 
Thanks for your response . Ok i am going enable PRAGMA auto_vacuum = FULL;........Is i am correct?
 
Yeps, It is. Take a look here sqlite.org/pragma.html#pragma_auto_vacuum
 
But i have one confusion that i have to enable this at my Android Service or in that class where database created. ?
 
This should be added when you create your database, as it can't be done after the tables are created. Then after every commit it will execute the vacuum command.
 
"Then after every commit it will execute the vacuum command."..means through service in particular interval of time.e.g Once in 24 hour or once in Week.
 
11:29 AM
Only if the service commits. Imagine that your service reads info from your ws but this gives no changes, then it doesn't update the database then there´s no commit so no vacuum gets executed. You are automating the vacuum command relaying on your logic layer of database interaction.
Hi Blue Green
 
hello
 
Is your service something like a db sync service?
 
yes.. but for Vacuum i wrote one another service... Actually its sync data from server in every 20 minute , but what was happening db size get increase day-by-day. Even in my android device we have only last 30 days data in our databse
yes.. but for Vacuum i wrote one another service... Actually its sync data from server in every 20 minute , but what was happening db size get increase day-by-day. Even in my android device we have only last 30 days data in our databse
 
If you set your Pragma to auto_vacuum then there´s no need for another service. Every time your actuall sync service commits it should run the vacuum command.
in the other hand, maybe you're not updating correctly your rows but inserting some kind of duplicates? The increase seems to be exponential?
 
ok.. We are using GreenDAO
 
11:39 AM
Never used it. Will take a look
 
I am just asking ..is it possible that it may be possible that journal file of DB doesn't get updated because in this project lot of cursor are used and it may be possible that some cursor is not closed that why ACID is not working?
 
If a cursor it's not closed at the end it will get full and throw an exception
 
YUp.. u r ryt... Actually u r absolutely correct. i am working on this project from last few days..
 
But you might be right about your journal file. Don't know how to check on this. Is there on greenDAO something like an upsert that your might be using?
 
YUp.. u r ryt... Actually u r absolutely correct. i am working on this project from last few days..
i have one more confusion that ... While using PRAGMA auto_vacuum = 0 | NONE | 1 | FULL | 2 | INCREMENTAL. it create one temp file at that time while this is executing application size increased double.
how can i handle this case?
 
11:50 AM
auto_vacuum should not create any additional files just reorder the database file. Maybe I´m missing something about your last message
 
But how can it reorder after every transaction if i call just once .....before DB creation
But how can it reorder after every transaction if i call just once .....before DB creation
 
you're not calling vacuum before DB creation. You're setting a global config parameter. That command (vacuum) will be automatically called after every transaction commits. You set it the first time and you forget about it for the rest of the execution.
 
Ok thanks.. a lot.....i will try your suggestion
PRAGMA auto_vacuum = 0 | NONE | 1 | FULL | 2 | INCREMENTAL; before DB Creation
 
good luck!
but one thing
you should first create your db and then run the pragma command
between creating your db and creating the tables
- Create db
- Execute pragma
- Create tables
 
Ok ... U r really very help full guy... thanks agn
 
12:04 PM
You're welcome :)
 
u r from where?
u r from where?
 
12:18 PM
Spain
 

last day (14 days later) »