Re: images in database?

From: Federico Razzoli <federico.razzoli_at_percona.com>
Date: Tue, 14 Jun 2016 00:03:59 -0700 (PDT)
Message-ID: <00705ce2-2d66-4111-86d2-cf767ca9e64a_at_googlegroups.com>


On Monday, June 6, 2016 at 2:43:36 PM UTC+2, mike..._at_gmail.com wrote:
> I’m working on an advertising network.
>
> Is it better to store the banners in the database or on the file system?
>
> Thank you.

Keeping an image in the db means that the database caches (InnoDB buffer pool or MyISAM key cache, and query cache if you use it) will contain the images you select. InnoDB has a mechanism to survive if the server crashes in the middle of a write, called doublewrite buffer - but this means that when you insert an image, it is written twice.

If you are concerned about your database performance, don't store your images there.

If your database has plenty of memory and is under-used, well, then you can waste its resources. In this (non-common) case, the overall performance of your application will be faster, because you get the image and other data with only one query. Personally I still don't like this, but in this case it's just my personal opinion. Received on Tue Jun 14 2016 - 09:03:59 CEST

Original text of this message