Reputation: 113
Background Info
I'm new to Android development and I'm creating an Android app for my clients, and I'm trying to figure out the best approach to storing a large amount of audio and image files for my app. The approach needs to fulfill the following requirements:
1) Allow users of the app to add their own images and audio files to the app (which uses a SQLite database). This potentially means that thousands of audio and image files will be stored, but again, they are no larger than 0.35 mb, and most are less than 0.1 mb. Users will likely be uploading bunches of files on the order of several dozen images and a quarter as many audio files.
2) Allow users to sync their local data with a SQL database on a server so that the images and audio files (in addition to allot of other data) can be uploaded, downloaded, and deleted by users of the app at different locations.
I'm aware that it is almost always preferable to store the file paths inside a SQLite database, rather than storing the files as BLOBS, but, as in these questions, BLOB vs. file path storage, Storing small BLOBs in a Database, there's some situations where storing the files directly in the database is more appropriate, especially so when the files involved are very small, as they are in my app. None of the files in my app are larger than 350 K/b.
My question is, when dealing with very small file sizes (none of my image/audio files exceed 350 k/b and most are in the 0 to 100 k/b range) but lots of files, is storing images directly as BLOBs rather than file paths going to cause any severe performance hits (as in ore than a few minutes) when users need to upload files to the local SQLite database or when users need to sync the local SQLite database to the remote server?
Lengthy installation times for the app and the initial sync with the remote database are not a problem as long as installation and sync doesn't take a crazy amount of time, say, longer than 45 minutes.
Upvotes: 0
Views: 1330
Reputation: 180070
Don't believe everything some random web site tells you.
In some tests for reading internal vs. external blobs, blobs are faster for very small file sizes (< 100 KB), and in any case, the difference is not very large for 300 KB files.
Writing blobs tends to be less efficient than writing files because of the transaction/synchronization overhead.
How all this translates to your Android device is something you have to test for yourself.
Upvotes: 2