Re: store pdf files

From: Andreas Joseph Krogh <andreak(at)officenet(dot)no>
To: pgsql-sql(at)postgresql(dot)org
Cc: Frank Bax <fbax(at)sympatico(dot)ca>
Subject: Re: store pdf files
Date: 2008-12-09 18:18:04
Message-ID: 200812091918.04751.andreak@officenet.no
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

On Tuesday 09 December 2008 18:57:15 Frank Bax wrote:
> ivan marchesini wrote:
> > Hi to all...
> > I need to create a db that contain link to some pdf files..
> > At the moment these are simple links (to the files that are stored into
> > the file system) storing paths into a column of a dbf table...
> >
> > I need to manage this data considering that the db I'm going to create
> > will be moved in some months to another server...
> > so I think that the link to the files positions into the file system
> > isn't a valid solution...
> >
> > can you suggest me a better way to manage this pdf data??
> > Each pdf is quite small (<100k)
> >
> > should I use BLOB?
>
>
> Leave the files on filesystem and code the highest level directory into
> a function.

Absolutely not. You'll loose transactional safety the DB provides. That reason alone is good enough to justify storing the files in a BLOB (BYTEA in PG).

The length(BYTEA)-function in PG can be used to retrieve its length. It is IMMUTABLE and "constant time", which means you can apply a functional-index on it. That way you don't need to store the size of the file in a separate column.

--
Andreas Joseph Krogh <andreak(at)officenet(dot)no>
Senior Software Developer / CEO
------------------------+---------------------------------------------+
OfficeNet AS | The most difficult thing in the world is to |
Karenslyst Allé 11 | know how to do a thing and to watch |
PO. Box 529 Skøyen | somebody else doing it wrong, without |
0214 Oslo | comment. |
NORWAY | |
Tlf: +47 24 15 38 90 | |
Fax: +47 24 15 38 91 | |
Mobile: +47 909 56 963 | |
------------------------+---------------------------------------------+

In response to

Browse pgsql-sql by date

  From Date Subject
Next Message Richard Huxton 2008-12-09 18:33:02 Re: inconsistent automatic casting between psql and function
Previous Message Thomas Kellerer 2008-12-09 18:05:10 Re: store pdf files