Re: Newbie: PG8 and text file parsing

From: Tatsuo Ishii <t-ishii(at)sra(dot)co(dot)jp>
To: blueaxon(at)gmail(dot)com
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: Newbie: PG8 and text file parsing
Date: 2005-02-19 02:15:01
Message-ID: 20050219.111501.104033145.t-ishii@sra.co.jp
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

> I need some advice.. I am new to PG8 - I am working on the project
> that needs to load data daily to PostgreSQL from the text file.. the
> text file is 40MB comma delimited file with row consisting of 20-30
> fields and couple thousands of rows..
>
> so the data needs to be parsed and if the row exists it needs to be
> updated, otherwise new record is going to be created. My problem is
> with parsing:
>
> 1-what would be a good approach to do it? is plpgSQL suitable for
> this? or should I use PHP or other language to to that and run as a
> cron job/service?

There are some tools which can read a text file and treat it as if
it's a real table. Using them would make your job much easier.

ftp://ftp.sra.co.jp/pub/cmd/postgres/exttable/exttable-0.5.tar.gz
http://pgfoundry.org/projects/dbi-link/

> 2-how about committing transactions? would there be a problem if it
> is done at the end of all the updates?

Not at all, I think.

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Richard Huxton 2005-02-19 10:17:51 Re: I'm newbie
Previous Message Joshua D. Drake 2005-02-19 01:55:02 Re: Newbie: PG8 and text file parsing