Re: How to store fixed size images?

From: Jeff Janes <jeff(dot)janes(at)gmail(dot)com>
To: sunpeng <bluevaley(at)gmail(dot)com>
Cc: PostgreSQL general <pgsql-general(at)postgresql(dot)org>
Subject: Re: How to store fixed size images?
Date: 2014-06-17 16:15:49
Message-ID: CAMkU=1xT9prj_2Gh7deQ4mEoHMzETB_DV=hZrrSBRwnOEwauJA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Mon, Jun 16, 2014 at 6:10 PM, sunpeng <bluevaley(at)gmail(dot)com> 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

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Khangelani Gama 2014-06-17 17:37:05 Re: pg_restore: custom archiver unexpected end of file , ERROR: missing data for column
Previous Message Keith Fiske 2014-06-17 15:48:39 Re: HOT standby with ONLY WAL shipping?