From: Stephen van Egmond <svanegmond@bang.dhs.org>
To: Chris <csmith@squiz.net>
Cc: Pgsql-Php <pgsql-php@postgresql.org>
Subject: Re: Question re large objects
Date: Tue, 28 Nov 2000 17:33:40 -0500
Message-ID: <20001128173340.A31096@bang.dhs.org> (raw)
In-Reply-To: <4.3.2.7.2.20001129085951.00b07d20@203.25.173.1>
References: <00d101c0596c$0d339c00$0200000a@windows>
<PBEMJIMKFNACLPCNPDEBMEMOEHAA.justinlong@strategicnetwork.o rg>
<4.3.2.7.2.20001129085951.00b07d20@203.25.173.1>
Chris (csmith@squiz.net) wrote:
> I'm in the (slow) process of writing a tutorial for this sort of thing (ie
> how to do it etc).
> This has probably been discussed before, but I'm looking for some positives
> & negatives for storing files in the database (I think you can use a switch
> on dump which dumps EVERYTHING, but I could be wrong), and some positives &
> negatives for outside the database in a seperate directory.
> Can someone send me some pointers & experiences :) (It doesn't have to go
> back to the list if no-one else is interested).
Pros to using large objects:
- makes your system scalable (i.e. many HTTP servers)
- clean
Cons:
- not currently dumpable
- user interface is a tiny bit tricky (possibly due to gaps in the php docs)
- introduces performance bottlenecks if you have many files coming out
of the RDBMS, as opposed to using flat files.
pg_dump will not dump large objects under any circumstances. Read the manual.
All of the above cons can be eliminated with some amount of work. You
can avoid unpleasant surprises by building an abstraction on top of
lowrite and loread, e.g.
pg_associate('Product', 'product_id', $product_id, 'product_image', $image_filename);
pg_find_association('Product', 'product_id', $product_id,
'product_image');
would be for this table:
CREATE TABLE Product (
product_id (...) primary key,
product_image oid
...
);
You can implement associate() to store the file and association
information somewhere in the filesystem, and make up a restore script
that will pump this saved information back into the db.
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-php@postgresql.org
Cc: svanegmond@bang.dhs.org, csmith@squiz.net
Subject: Re: Question re large objects
In-Reply-To: <20001128173340.A31096@bang.dhs.org>
References: <00d101c0596c$0d339c00$0200000a@windows> <4.3.2.7.2.20001129085951.00b07d20@203.25.173.1> <20001128173340.A31096@bang.dhs.org>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox