473,386 Members | 1,736 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

how to import data into table

How does one import data INTO a table. I am forced to read files (\i)
w/ a ton of insert statements. I am trying to import approx 800 lines
into the table. However, I must bundle them into a series of files
because of the bug in PGSQL (the buffer overflows). Interestingly,
the literature claims that the one feature of PostgreSQL is SPEED.
HA! Reading a single file w/ all the same inserts into MySQL takes
literally a fraction of a second. Reading the series of files into
PostgreSQL takes several minutes. Pls advise. Otherwise I am forced
to use MySQL. Thx.

PS. I am using v 6.5.3 which ships w/ RedHat 6.2
Jul 19 '05 #1
3 45171
John Kolvereid wrote:
How does one import data INTO a table. I am forced to read files (\i)
w/ a ton of insert statements. I am trying to import approx 800 lines
into the table. However, I must bundle them into a series of files
because of the bug in PGSQL (the buffer overflows). Interestingly,
the literature claims that the one feature of PostgreSQL is SPEED.
HA! Reading a single file w/ all the same inserts into MySQL takes
literally a fraction of a second. Reading the series of files into
PostgreSQL takes several minutes. Pls advise. Otherwise I am forced
to use MySQL. Thx.

PS. I am using v 6.5.3 which ships w/ RedHat 6.2

If you have a single file with all of the inserts in it, use it. From
your postgres home directory use:
psql -d myDataBase -a -f myInsertFile

The -a parameter echos the results to the screen. If your data file is
just data (ie no SQL) use the COPY command from your home directory.

hth
Ron

BTW you should upgrade. There have been a lot of improvements in the
database since 6.5.3.

Jul 19 '05 #2
Hi Ron,
Thx for the reply. Here's what happened. My db is named 'odin'
and my text file is 'mails.out'. I Tried the following:
psql -d odin -a -f mails.out
response: Connection to database 'mails.out' failed.
psql odin -a -f mails.out
response: Connection to database 'postgres' failed.
It was not until I omitted the '-a' until it worked. And it did!.
However, I would like to shut off the echos as you indicated the -a
would do. That does not seem possible.
Also, I had tried the COPY command before. I tried it from
within a session and got the following:
odin=> copy dem from '/pub/mails/mails.tab';
ERROR: pg_atoi: error in "Mark": can't parse "Mark"
The tab-delimited file is '/pub/mails/mails.tab' and the 1st line is:
Mark Addington *@focus-asia.com
Let's hope you are right:
'There have been a lot of improvements in the database since 6.5.3.'

Thx for getting back. So far I am very unimpressed w/ PostgreSQL.

rstp <rs**@linuxwaves.com> wrote in message news:<3F**************@linuxwaves.com>...
John Kolvereid wrote:
How does one import data INTO a table. I am forced to read files (\i)
w/ a ton of insert statements. I am trying to import approx 800 lines
into the table. However, I must bundle them into a series of files
because of the bug in PGSQL (the buffer overflows). Interestingly,
the literature claims that the one feature of PostgreSQL is SPEED.
HA! Reading a single file w/ all the same inserts into MySQL takes
literally a fraction of a second. Reading the series of files into
PostgreSQL takes several minutes. Pls advise. Otherwise I am forced
to use MySQL. Thx.

PS. I am using v 6.5.3 which ships w/ RedHat 6.2

If you have a single file with all of the inserts in it, use it. From
your postgres home directory use:
psql -d myDataBase -a -f myInsertFile

The -a parameter echos the results to the screen. If your data file is
just data (ie no SQL) use the COPY command from your home directory.

hth
Ron

BTW you should upgrade. There have been a lot of improvements in the
database since 6.5.3.

Jul 19 '05 #3
Hi John,

Check out the "COPY" command. Its in the Reference section of the
PostgreSQL documentation. I usually find that I need to be logged in as
the Postgresql super user in order to get it to work.

P.S.: if MySQL works better for you, why don't you just use it?

Cheers,
w.k.

Q: How many Zen masters does it take to screw in a light bulb?
A: None. The universe spins the bulb and the Zen master stays out
of the way.

On Wed, 20 Aug 2003, John Kolvereid wrote:
How does one import data INTO a table. I am forced to read files (\i)
w/ a ton of insert statements. I am trying to import approx 800 lines
into the table. However, I must bundle them into a series of files
because of the bug in PGSQL (the buffer overflows). Interestingly,
the literature claims that the one feature of PostgreSQL is SPEED.
HA! Reading a single file w/ all the same inserts into MySQL takes
literally a fraction of a second. Reading the series of files into
PostgreSQL takes several minutes. Pls advise. Otherwise I am forced
to use MySQL. Thx.

PS. I am using v 6.5.3 which ships w/ RedHat 6.2

Jul 19 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Doug Baroter | last post by:
Hi, One of my clients has the following situation. They use Access DB for data update etc. some business functions while they also want to view the Access data quickly and more efficiently in...
2
by: Fred | last post by:
Hi. How do I import while mapping an excel table to an access table please??? I've searched around and all I can find is a software product or code that does the same thing as the access...
4
by: Steve Jorgensen | last post by:
I'm restarting this thread with a different focus. The project I'm working on now id coming along and will be made to work, and it's too late to start over with a new strategy. Still, I'm not...
3
by: deko | last post by:
I've been trying to use the Access Import Wizard to expedite importing data into my mdb. The nice thing about the wizard is that I can import from different file formats - txt, xls, even Outlook -...
10
by: shumaker | last post by:
I don't need a detailed description of a solution(although I wouldn't mind), but I am hoping someone could tell me in general the best path to go about accomplishing a task, since I don't know all...
3
by: ninrulz | last post by:
I will try to explain my situation. I know that it is hard to offers solutions without fully understanding what people would like to achieve. I receive 2 csv files every month. The csv files...
11
by: kaisersose1995 | last post by:
Hi, I've got an import procedure working, using a standard import specification to import a .csv file into a temporary table. The problem i'm having is that i have 4 different sets of borrower...
1
by: JC | last post by:
I have a table which is replicated for after images only. I tried to do an import using the replace option into the source table with data. For some of the rows, they were not in the import file,...
4
by: Earl Anderson | last post by:
I guess I missed the boat on the logic for this one. Immediately upon hitting "Import" in an attempt to import an Excel file containing 7 columns of 'txt' formatted data into AXP, I got a "Type...
6
by: provor | last post by:
Hello, I have the following code that I am using when a user presses a button to import an excel file into a table. The code is hard coded to point to the correct table. This works great for this...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.