Thread: Large Objects
I have a collection of images that I want to store in a database. The collection is currently 12 GB. Can anyone give me some advice or links to any documents that discuss the different methods to accomplish this. I already read techdocs documents related to large objects. I just want some advice on good ways to do it. The database is going to be accessed through a Servlet (JDBC). One thing that wasn't clear from techdocs was the disk space usage. If i store 12 GB in the database without deleting it from the filesystem, it is going to occupy another 12 GB. Is this right? Thanks in advance. nadim
On Wed, Jun 26, 2002 at 08:56:11PM -0700, Nadim Bitar wrote: > > > I have a collection of images that I want to store in a database. The > collection is currently 12 GB. Are you sure? Why not use standard FS and to DB store path to files? :-) > Can anyone give me some advice or links to any documents that discuss > the different methods to accomplish this. I already read techdocs > documents related to large objects. I just want some advice on good ways > to do it. The current PostgreSQL allows to store large data to standard table rows too. You needn't use large-object interface. > The database is going to be accessed through a Servlet (JDBC). > One thing that wasn't clear from techdocs was the disk space usage. If i > store 12 GB in the database without deleting it from the filesystem, it > is going to occupy another 12 GB. Is this right? Sure. The database use own and private dataspace and not links to some external files. Karel -- Karel Zak <zakkr@zf.jcu.cz> http://home.zf.jcu.cz/~zakkr/ C, PostgreSQL, PHP, WWW, http://docs.linux.cz, http://mape.jcu.cz
The only thing that concerns me about using the filesystem is what happens if the user deletes an image from the FS, the image table would be in an inconsistent state. Still trying to think of an elegant solution to solve that. On 木, 2002-06-27 at 00:50, Karel Zak wrote: > On Wed, Jun 26, 2002 at 08:56:11PM -0700, Nadim Bitar wrote: > > > > > > I have a collection of images that I want to store in a database. The > > collection is currently 12 GB. > > Are you sure? Why not use standard FS and to DB store path to files? :-) > > > Can anyone give me some advice or links to any documents that discuss > > the different methods to accomplish this. I already read techdocs > > documents related to large objects. I just want some advice on good ways > > to do it. > > The current PostgreSQL allows to store large data to standard table > rows too. You needn't use large-object interface. > > > The database is going to be accessed through a Servlet (JDBC). > > One thing that wasn't clear from techdocs was the disk space usage. If i > > store 12 GB in the database without deleting it from the filesystem, it > > is going to occupy another 12 GB. Is this right? > > Sure. The database use own and private dataspace and not links to > some external files. > > Karel > > -- > Karel Zak <zakkr@zf.jcu.cz> > http://home.zf.jcu.cz/~zakkr/ > > C, PostgreSQL, PHP, WWW, http://docs.linux.cz, http://mape.jcu.cz
One obvious solution is to handle this at the application level. Read database to get path to image file, retrieve image file if it exists, and if it doesn't exist, delete or modify the database record to reflect what you just learned about reality. If necessary, you could periodically go through every path in the database to verify their existence on the FS, and delete the path records for missing files en masse, though I wouldn't do this too often. Hope this helps, Wes Nadim Bitar <nadiizu%earthlink.net@interlock.lexmark.com> on 06/27/2002 06:10:07 AM To: Karel Zak <zakkr%zf.jcu.cz@interlock.lexmark.com> cc: pgsql-general%postgresql.org@interlock.lexmark.com (bcc: Wesley Sheldahl/Lex/Lexmark) Subject: Re: [GENERAL] Large Objects The only thing that concerns me about using the filesystem is what happens if the user deletes an image from the FS, the image table would be in an inconsistent state. Still trying to think of an elegant solution to solve that. On 木, 2002-06-27 at 00:50, Karel Zak wrote: > On Wed, Jun 26, 2002 at 08:56:11PM -0700, Nadim Bitar wrote: > > > > > > I have a collection of images that I want to store in a database. The > > collection is currently 12 GB. > > Are you sure? Why not use standard FS and to DB store path to files? :-) > > > Can anyone give me some advice or links to any documents that discuss > > the different methods to accomplish this. I already read techdocs > > documents related to large objects. I just want some advice on good ways > > to do it. > > The current PostgreSQL allows to store large data to standard table > rows too. You needn't use large-object interface. > > > The database is going to be accessed through a Servlet (JDBC). > > One thing that wasn't clear from techdocs was the disk space usage. If i > > store 12 GB in the database without deleting it from the filesystem, it > > is going to occupy another 12 GB. Is this right? > > Sure. The database use own and private dataspace and not links to > some external files. > > Karel > > -- > Karel Zak <zakkr@zf.jcu.cz> > http://home.zf.jcu.cz/~zakkr/ > > C, PostgreSQL, PHP, WWW, http://docs.linux.cz, http://mape.jcu.cz ---------------------------(end of broadcast)--------------------------- TIP 2: you can get off all lists at once with the unregister command (send "unregister YourEmailAddressHere" to majordomo@postgresql.org)