pg.ddx.io  pgsql-admin@postgresql.org mailing list archive  
help / color / mirror / Atom feed
Fast load
4+ messages / 3 participants
[nested] [flat]

* Fast load
@ 2001-08-24 21:49  Ted Rolle <ted@tvlconn.com>
  0 siblings, 2 replies; 4+ messages in thread

From: Ted Rolle @ 2001-08-24 21:49 UTC (permalink / raw)
  To: pgsql-admin

We have 73 databases, two dozen with hundreds of thousands to millions of
records, with lengths in the 500-byte range.  I'm planning to convert them
from Btrieve to PostgreSQL.

Of course, I want the highest reasonable speed so that the conversion can be
completed - say - in a week-end.

My initial take is to create a tab-delimited file and use this as input to
the \copy command in psql.

Another option might be to feed them directly to the back end.

I'm a C programmer, so writing the necessary programs for the conversion and
load is not a problem.

Any pointers?

Not-wanting-to-go-down-a-garden-pathingly,

Ted




^ permalink  raw  reply  [nested|flat] 4+ messages in thread

* Re: Fast load
@ 2001-08-24 22:50  Jeremy Buchmann <jeremy@wellsgaming.com>
  parent: Ted Rolle <ted@tvlconn.com>
  1 sibling, 1 reply; 4+ messages in thread

From: Jeremy Buchmann @ 2001-08-24 22:50 UTC (permalink / raw)
  To: Ted Rolle <ted@tvlconn.com>; pgsql-admin

> We have 73 databases, two dozen with hundreds of thousands to millions of
> records, with lengths in the 500-byte range.  I'm planning to convert them
> from Btrieve to PostgreSQL.
> 
> Of course, I want the highest reasonable speed so that the conversion can be
> completed - say - in a week-end.
> 
> My initial take is to create a tab-delimited file and use this as input to
> the \copy command in psql.
> 
> Another option might be to feed them directly to the back end.
> 
> I'm a C programmer, so writing the necessary programs for the conversion and
> load is not a problem.
> 
> Any pointers?

Use \copy.  It's very fast at importing tab-delimited text files.  Just make
sure that what you export from the old database is very "clean", meaning no
quotes around text fields, no tabs within a field, that sort of thing.  73
is a lot of databases, but it will probably take you more time to actually
type the \copy commands than it will for postgres to copy the data.

-- Jeremy  [jeremy@wellsgaming.com]





^ permalink  raw  reply  [nested|flat] 4+ messages in thread

* RE: Fast load
@ 2001-08-24 23:00  Ted Rolle <ted@tvlconn.com>
  parent: Jeremy Buchmann <jeremy@wellsgaming.com>
  0 siblings, 0 replies; 4+ messages in thread

From: Ted Rolle @ 2001-08-24 23:00 UTC (permalink / raw)
  To: 'Jeremy Buchmann' <jeremy@wellsgaming.com>; pgsql-admin

Jeremy: Thanks for the quick reply.

That's REALLY encouraging!  We're converting them from Btrieve 6.0 to
Btrieve 7.0, and it's a real slow process for the big ones.

One of the larger Btrieve files blew up the conversion program (from the
vendor, no less).  The file has 1,296,418 446-byte records.
It's been running over two hours and it's at 916,200 records.  Every so
often it stops to take a big, long rest.  Stops for about 10 minutes, and
then merrily goes on its way for a while longer.  I'm surmising that this is
kswapd doing it's thing.





^ permalink  raw  reply  [nested|flat] 4+ messages in thread

* Re: Fast load
@ 2001-08-24 23:59  Peter Eisentraut <peter_e@gmx.net>
  parent: Ted Rolle <ted@tvlconn.com>
  1 sibling, 0 replies; 4+ messages in thread

From: Peter Eisentraut @ 2001-08-24 23:59 UTC (permalink / raw)
  To: Ted Rolle <ted@tvlconn.com>; +Cc: pgsql-admin

Ted Rolle writes:

> We have 73 databases, two dozen with hundreds of thousands to millions of
> records, with lengths in the 500-byte range.  I'm planning to convert them
> >from Btrieve to PostgreSQL.
>
> Of course, I want the highest reasonable speed so that the conversion can be
> completed - say - in a week-end.

The fastest possible way to get data loaded into PostgreSQL is to create a
tab-delimited file and feed it directly to the backend with the COPY
command.  To speed things up even more, turn off fsync (-F), create the
indexes after loading, and the same with triggers, if you have any.  I'd
like to think that all of this should take significantly less than a
weekend. ;-)

Formatting the data into the right format for COPY can be done with your
favourite text mashing tools.

-- 
Peter Eisentraut   peter_e@gmx.net   http://funkturm.homeip.net/~peter




^ permalink  raw  reply  [nested|flat] 4+ messages in thread


end of thread, other threads:[~2001-08-24 23:59 UTC | newest]

Thread overview: 4+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2001-08-24 21:49 Fast load Ted Rolle <ted@tvlconn.com>
2001-08-24 22:50 ` Jeremy Buchmann <jeremy@wellsgaming.com>
2001-08-24 23:00   ` Ted Rolle <ted@tvlconn.com>
2001-08-24 23:59 ` Peter Eisentraut <peter_e@gmx.net>

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