472,782 Members | 1,305 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,782 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 45126
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: Rina0 | last post by:
Cybersecurity engineering is a specialized field that focuses on the design, development, and implementation of systems, processes, and technologies that protect against cyber threats and...
0
by: erikbower65 | last post by:
Using CodiumAI's pr-agent is simple and powerful. Follow these steps: 1. Install CodiumAI CLI: Ensure Node.js is installed, then run 'npm install -g codiumai' in the terminal. 2. Connect to...
0
linyimin
by: linyimin | last post by:
Spring Startup Analyzer generates an interactive Spring application startup report that lets you understand what contributes to the application startup time and helps to optimize it. Support for...
0
by: erikbower65 | last post by:
Here's a concise step-by-step guide for manually installing IntelliJ IDEA: 1. Download: Visit the official JetBrains website and download the IntelliJ IDEA Community or Ultimate edition based on...
0
by: kcodez | last post by:
As a H5 game development enthusiast, I recently wrote a very interesting little game - Toy Claw ((http://claw.kjeek.com/))。Here I will summarize and share the development experience here, and hope it...
5
by: DJRhino | last post by:
Private Sub CboDrawingID_BeforeUpdate(Cancel As Integer) If = 310029923 Or 310030138 Or 310030152 Or 310030346 Or 310030348 Or _ 310030356 Or 310030359 Or 310030362 Or...
0
by: lllomh | last post by:
Define the method first this.state = { buttonBackgroundColor: 'green', isBlinking: false, // A new status is added to identify whether the button is blinking or not } autoStart=()=>{
0
by: lllomh | last post by:
How does React native implement an English player?
2
by: DJRhino | last post by:
Was curious if anyone else was having this same issue or not.... I was just Up/Down graded to windows 11 and now my access combo boxes are not acting right. With win 10 I could start typing...

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.