Thread: Importing delimited files

Importing delimited files

From
kheflin
Date:
I've usually imported any delimited text files into my PostgreSQL
databases using "PGACCESS" which has worked great for me. Our System
Admin here is wanting to import a delimited text file into a postgresql
database using the psql command line...

any suggestions?

Kevin

--------------------------------------------------------------------
Kevin Heflin          | ShreveNet, Inc.      | Ph:318.222.2638 x103
VP/Mac Tech           | 333 Texas St #619    | FAX:318.221.6612
kheflin@shreve.net    | Shreveport, LA 71101 | http://www.shreve.net
--------------------------------------------------------------------


Re: [GENERAL] Importing delimited files

From
"Brett W. McCoy"
Date:
On Mon, 22 Jun 1998, kheflin wrote:

> I've usually imported any delimited text files into my PostgreSQL
> databases using "PGACCESS" which has worked great for me. Our System
> Admin here is wanting to import a delimited text file into a postgresql
> database using the psql command line...
>
> any suggestions?

Use the SQL command COPY for importing a delimited fileinto a tabl.  You
can also use the psql command \copy, but it isn't as flexible.  Take a
look at the online help in psql for the exact syntax of both commands.

Brett W. McCoy
                                         http://www.lan2wan.com/~bmccoy
-----------------------------------------------------------------------
"The Number of UNIX installations has grown to 10, with more expected."
   -- The UNIX Programmer's Manual, 2nd Edition, June, 1972


Re: [GENERAL] Importing delimited files

From
Tom Good
Date:
On Mon, 22 Jun 1998, kheflin wrote:

> I've usually imported any delimited text files into my PostgreSQL
> databases using "PGACCESS" which has worked great for me. Our System
> Admin here is wanting to import a delimited text file into a postgresql
> database using the psql command line...
>
> any suggestions?
>
> Kevin

Hi,

I just finished loading 54,000 + records into postgres, from the command
line.

$ pgsql -e dbname < loadfile

At the top of the file I put;
COPY table_name FROM stdin;

At EOF I put:
\.

BTW, loading 54353 records (22 attributes) into a db took about 4 minutes
on a 486 dx2/66 (all scsi) with a lowly 32M of RAM...

Once I created my index, selecting one record from this soup takes less
than a second (linux 2.0.27)...

Good luck!
===================================================================
        User Guide Dog Database Project
===================================================================
                  Powered by PostgreSQL 6.3.2
       * Advanced Database Design - Proven Performance *
                             ----
               Perl 5.004 / DBI-0.91::DBD-PG-0.69
===================================================================
                   http://www.panix.com/~ugd
===================================================================