Allows state that I've an application that allows you search through all of the cars present in a Sqlite database. Whenever you click a vehicle within the listing, it'll open a view using the description from the vehicle along with a photo from the vehicle.

My real question is: must i keep your photo within the database like a binary data column within the row with this specific vehicle, or must i possess the photo somewhere within the assets directory? What's best to complete? What are the restrictions of Sqlite when it comes to how large a binary data column could be?

The database is going to be virtually be read only and bundled up using the application (therefore the user would not be placing any cars as well as their photos).

This can be a decision that is talked about quite a bit. And for me, it's dependent on personal taste. Virtually like vim/emacs, home windows/linux type of debates. Not too heated though.

Each side get their pros and cons. Whenever you store these questions database, you don't have to worry about filename and placement. Management can also be simpler (you remove the row(s) that contains the BLOBs, and that is it). However the files will also be harder to gain access to and also you may have to write wrapper code in a single way or another (f.ex. a number of individuals "download.php" links).

However, when the binary information is saved like a separate file, management is much more complicated (You have to open the correct file in the disk by creating the filename first). On large data sets you might encounter filesystem bottlenecks when the amount of files in a single directory develops large (but this is often avoided by creating subdirs easily). However, when the information is saved as files, changing them becomes a lot simpler. Others may also can get on with no need to be aware of internals (imagine for instance a person who takes fun in designing his/her UI).

I am sure that you will find other indicates be elevated, but I'd rather not write an excessive amount of now...

I'd say: Consider what procedures you need related to the photos (and also the restrictions of both storage techniques), and after that take an educated decision. There isn't much that may fail.

Texas-Log and FS-Journal

On further analysis I discovered more info:

  • SQLite utilizes a Transaction Log
  • Android uses YAFFS around the system mount points and VFAT around the SD-Card. Both of them are (to the very best of my knowlege) unjournaled.

I'm not sure the precise implementation of SQLite's Texas-Log, however it isn't surprising that every INSERT/UPDATE operation will work two creates around the disk. I might be mistaken (it largely is dependent around the implementation of transactions), but frankly, I could not be bothered to skim with the SQLite source code. It feels in my experience like starting splitting fur here (premature optimisation anybody?)...

As both file systems (YAFFS and VFAT) aren't journalled, you've got no additional "hidden" write procedures.

Both of these points speak towards the file system.

Observe that this data will be taken having a touch of suspicion. I only skimmed within the Google outcomes of YAFFS journaling and sqlite transaction log. I might have skipped some particulars.

The default MAX SQLite size for any BLOB or String is 231-1 bytes. That value also is applicable towards the maximum bytes to become saved consecutively.

Regarding which technique is better, I don't know. Things I would do inside your situation is test both techniques and monitor the memory usage and it is impact on battery existence. Maybe you will find the filesystem method includes a obvious edge on another for the reason that area and the simplicity of storing it in SQLite isn't worthwhile to use situation, or possibly you will find the alternative.