On 8 Oct 2012, at 11:25am, Paxdo Presse <[email protected]> wrote:

> Hello,
> 
> The context:
> - Web application
> - Billing application
> - Sqlite with WAL mode
> - The database is shared among many clients.
> 
> Images are handled in the app: photo of products, photos of customers, etc.
> Each client can have thousands.
> Advise you manage images as blob in the database? or have only the URL of 
> images in the database (so the image files on the hard disk)?
> 
> The first solution seems simpler, more secure. But is it slows down 
> significantly the database? Especially if the database is encrypted?

Using a web service is different to asking the same question about an app which 
runs on one computer.  If your web server would serve the images straight from 
files on disk, I would leave the images as individual files.  Web server 
software is optimised to serve many different files, caching them 
intelligently.  It will do a good job of working out how to serve many 
different files in an efficient manner.

If you keep the image data inside the database you have to write some code 
which will extract the data and present it as an 'image/jpeg' file or whatever 
it is.  This isn't too difficult but it's one more thing to go wrong, the 
server won't be able to cache those returns, and doing the processing 
(especially for an encrypted database) will require more CPU than just serving 
the images from disk.  If secrecy of the images is an issue make sure you are 
serving over HTTPS not HTTP.

So I would keep just the URLs in the database.  There is nothing impossible 
about the other solution, but I think it will be less efficient.

Simon.
_______________________________________________
sqlite-users mailing list
[email protected]
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to