On Mon, Jun 16, 2014 at 6:10 PM, sunpeng <bluevaley@xxxxxxxxx> wrote: > We have many small size(most fixed size) images, how to store them? There > are two options: > 1. Store images in folders, managed by os file system, only store path in > postgresql > 2. Store image as bytea in postgresql > How do you usually store images? I use method 1, because the library/modules I made use of only implemented that method. I'd prefer to use method 2, but not enough to write the code for doing it when there was existing code. The problem with 1 is now you have two streams of data to back up, and the data itself is no longer transactional with its metadata. A potential problem with 2 is that it will run into problems if any of the data is more than a small fraction of RAM. So the images must be "always small". If they are just "usually small", that isn't good enough. Another problem with bytea is the encoding issues. Good up-to-date drivers will handle that for you (mostly) transparently, but there are lots of drivers that are not good, or not up-to-date. Cheers, Jeff