Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

SQLite and storing images

Tags:

android

sqlite

I wonder which way is better to store images in memory:

  • Storing images as BLOB in DB

or

  • Saving images to file and store only path to it in database

What way is more efficient? I suppose that storing files' paths requires more operations because we need to refer to DB and then to file, but I'm not sure if this is less efficent than keeping whole images in DB.

like image 237
Kamil Lelonek Avatar asked Apr 10 '13 20:04

Kamil Lelonek


1 Answers

In a nutshell:

  • If size of your images are fairly small and number of images are also less, go for storing directly in database, as it is simpler to manage.
  • However, if size of your images in large and also number of images is high, go for saving in file system. Typically, database don't show any performance issues until 10MB for an average mobile.

Let me know if you find any other criteria of judgement.

like image 165
Gaurav Arora Avatar answered Sep 18 '22 18:09

Gaurav Arora