Re: [GENERAL] How to store text files in the postgresql?

2009-06-13 Thread Alban Hertroys
On Jun 12, 2009, at 11:53 AM, Yaroslav Tykhiy wrote: I cannot but ask the community a related question here: Can such design, that is, storing quite large objects of varying size in a PostgreSQL database, be a good idea in the first place? I used to believe that what RDBMS were really

Re: [GENERAL] How to store text files in the postgresql?

2009-06-12 Thread Yaroslav Tykhiy
DimitryASuplatov wrote: My task is to store a lot (10^5) of small ( 10 MB) text files in the database with the ability to restore them back to the hard drive on demand. I cannot but ask the community a related question here: Can such design, that is, storing quite large objects of varying

Re: [GENERAL] How to store text files in the postgresql?

2009-06-12 Thread Andy Colson
Yaroslav Tykhiy wrote: DimitryASuplatov wrote: My task is to store a lot (10^5) of small ( 10 MB) text files in the database with the ability to restore them back to the hard drive on demand. I cannot but ask the community a related question here: Can such design, that is, storing quite

Re: [GENERAL] How to store text files in the postgresql?

2009-06-12 Thread Emanuel Calvo Franco
2009/6/6 DimitryASuplatov gene...@gmail.com: Hello, I am very new to postgresql database. I`ve used a little of MySql previously. My task is to store a lot (10^5) of small ( 10 MB) text files in the database with the ability to restore them back to the hard drive on demand. That means

Re: [GENERAL] How to store text files in the postgresql?

2009-06-12 Thread Greg Stark
This is a recurring debate and there are pros and cons for both sides. It usually comes down to whether you need transactional guarantees for these large objects. There are also practical concerns. Transfering these large objects over a single database tcp connection limits the application

Re: [GENERAL] How to store text files in the postgresql?

2009-06-12 Thread Scott Ribe
If I had an admin roaming through my document server deleting document files out from under my database, that's a problem I would solve very quickly--with a completely non-technical solution. After all, what's to prevent such a person from deleting pgsql data files??? -- Scott Ribe

Re: [GENERAL] How to store text files in the postgresql?

2009-06-12 Thread Andy Colson
Scott Ribe wrote: If I had an admin roaming through my document server deleting document files out from under my database, that's a problem I would solve very quickly--with a completely non-technical solution. After all, what's to prevent such a person from deleting pgsql data files??? Yea,

Re: [GENERAL] How to store text files in the postgresql?

2009-06-12 Thread Alan Hodgson
On Friday 12 June 2009, Greg Stark gsst...@mit.edu wrote: Also, it makes backups a pain since it's a lot easier to back up a file system than a database. But that gets back to whether you need transactional guarantees. The reason it's a pain to back up a database is precisely because it needs

Re: [GENERAL] How to store text files in the postgresql?

2009-06-12 Thread Scott Ribe
It's far easier to backup and restore a database than millions of small files. Small files = random disk I/O. The real downside is the CPU time involved in storing and retrieving the files. If it isn't a show stopper, then putting them in the database makes all kinds of sense. On the

Re: [GENERAL] How to store text files in the postgresql?

2009-06-12 Thread Alan Hodgson
On Friday 12 June 2009, Scott Ribe scott_r...@killerbytes.com wrote: It's far easier to backup and restore a database than millions of small files. Small files = random disk I/O. The real downside is the CPU time involved in storing and retrieving the files. If it isn't a show stopper,

Re: [GENERAL] How to store text files in the postgresql?

2009-06-12 Thread Craig Ringer
On Fri, 2009-06-12 at 19:53 +1000, Yaroslav Tykhiy wrote: DimitryASuplatov wrote: My task is to store a lot (10^5) of small ( 10 MB) text files in the database with the ability to restore them back to the hard drive on demand. I cannot but ask the community a related question here:

Re: [GENERAL] How to store text files in the postgresql?

2009-06-12 Thread Craig Ringer
On Fri, 2009-06-12 at 09:07 -0700, Alan Hodgson wrote: On Friday 12 June 2009, Scott Ribe scott_r...@killerbytes.com wrote: It's far easier to backup and restore a database than millions of small files. Small files = random disk I/O. That depends on how you're backing up. If you want to

Re: [GENERAL] How to store text files in the postgresql?

2009-06-08 Thread Steve Crawford
DimitryASuplatov wrote: My task is to store a lot (10^5) of small ( 10 MB) text files in the database with the ability to restore them back to the hard drive on demand. That means that I need two functions. First - grab file from the directory, store it in the database and delete from the disk;

Re: [GENERAL] How to store text files in the postgresql?

2009-06-07 Thread Florian Weimer
* DimitryASuplatov: I`ve also worked out how to do this simply from bash ./bin/psql mypdb EOF insert into pdb values ('`cat /file/name`'); EOF This doesn't work if the file contains embedded ' characters (and backslashes and NULs are also problematic). You will also get errors if the file

Re: [GENERAL] How to store text files in the postgresql?

2009-06-07 Thread Johan Nel
1/ Is it possible? 2/ Could you give me some quick tips on how to manage it from the start so that I knew what to look for in the manual? Not sure how much you know about programming, but easiest will probably be to have a small application. Here is some code in the Npgsql library

Re: [GENERAL] How to store text files in the postgresql?

2009-06-07 Thread Dimitri Fontaine
Hi, Le 6 juin 09 à 12:41, DimitryASuplatov a écrit : My task is to store a lot (10^5) of small ( 10 MB) text files in the database with the ability to restore them back to the hard drive on demand. The following article deals specifically with files containing XML but goes as far as

[GENERAL] How to store text files in the postgresql?

2009-06-06 Thread DimitryASuplatov
Hello, I am very new to postgresql database. I`ve used a little of MySql previously. My task is to store a lot (10^5) of small ( 10 MB) text files in the database with the ability to restore them back to the hard drive on demand. That means that I need two functions. First - grab file from the

Re: [GENERAL] How to store text files in the postgresql?

2009-06-06 Thread Leif B. Kristensen
On Saturday 6. June 2009, DimitryASuplatov wrote: Hello, I am very new to postgresql database. I`ve used a little of MySql previously. My task is to store a lot (10^5) of small ( 10 MB) text files in the database with the ability to restore them back to the hard drive on demand. That means that

Re: [GENERAL] How to store text files in the postgresql?

2009-06-06 Thread Raymond O'Donnell
On 06/06/2009 11:41, DimitryASuplatov wrote: My task is to store a lot (10^5) of small ( 10 MB) text files in the database with the ability to restore them back to the hard drive on demand. That means that I need two functions. First - grab file from the directory, store it in the database

Re: [GENERAL] How to store text files in the postgresql?

2009-06-06 Thread Raymond O'Donnell
On 06/06/2009 14:37, DimitryASuplatov wrote: But then comes the problem because the only command I found to read in the file content is COPY but the following command would not work Yes, this wont work here - COPY is intended for reading an entire table to or from a disk file, not a single

Re: [GENERAL] How to store text files in the postgresql?

2009-06-06 Thread DimitryASuplatov
Thank you very much. I`ve also worked out how to do this simply from bash ./bin/psql mypdb EOF insert into pdb values ('`cat /file/name`'); EOF SDA On Sat, 2009-06-06 at 16:32 +0100, Raymond O'Donnell wrote: On 06/06/2009 14:37, DimitryASuplatov wrote: But then comes the problem because

Re: [GENERAL] How to store text files in the postgresql?

2009-06-06 Thread DimitryASuplatov
Thank you for answering. I`ve read a manual and now I have a more advanced question. 1/ I`ve created a table in the database mypdb=# create table pdb( index int, filename text, filecontent text ); 2/ Then I want to read a file into it First I insert metainfo mypdb=# insert into pdb (index ,