Re: Best way to store and retrieve photo from PostGreSQL

Поиск
Список
Период
Сортировка
От Tommy Gildseth
Тема Re: Best way to store and retrieve photo from PostGreSQL
Дата
Msg-id 45E1B7F9.9050804@gildseth.com
обсуждение исходный текст
Ответ на Re: Best way to store and retrieve photo from PostGreSQL  (Andreas Kretschmer <akretschmer@spamfence.net>)
Список pgsql-general
Andreas Kretschmer wrote:
> Alain Roger <raf.news@gmail.com> schrieb:
>
>
>> Hi,
>>
>> I would like to store picture in my DB and after to display them on my PHP
>> pages.
>>
>> What is the best solution for that ?
>>
>
> Store the pictures in the filesystem and only the path, description and
> other metadata in the database. My suggestion ;-)

One problem with this approach, is that you move the responsibility for
maintaining data integrity from the database, to the application code
using the database. You introduce 2 points of failure, where you risk
adding the image to the filesystem, without it being added to the
database, and the other way around. The same issue appears with
deleting/updating.
In addition, if there is a large amount of images, you probably do not
want to keep all images in the same folder. So you introduce extra
complexity in order to maintain a directory structure, and some sort of
logic for sorting the images in this structure.

--
Tommy




В списке pgsql-general по дате отправления:

Предыдущее
От: "Joris Dobbelsteen"
Дата:
Сообщение: Re: Best way to store and retrieve photo from PostGreSQL
Следующее
От: "Robert Haas"
Дата:
Сообщение: Re: complex referential integrity constraints