pg.ddx.io pgsql-sql@postgresql.org mailing list archive
help / color / mirror / Atom feed\copy...
8+ messages / 6 participants
[nested] [flat]
* \copy...
@ 2000-06-15 18:32 Ed <ed@jetumele.com>
0 siblings, 1 reply; 8+ messages in thread
From: Ed @ 2000-06-15 18:32 UTC (permalink / raw)
To: pgsql-sql
Hi,
I have a file that look like this :
firstname|lastname|email@domain.com
firstname2|lastname2|email2@domain.com
and a table foo like :
firstname varchar(30),
lastname varchar(30),
email varchar(50)
and I would like to do a :
copy tablename from '/home/ed/import.dat';
But then, everything goes in the first field... what does i'm doing
wrong?!?!
Frédéric Boucher
Ed@jetumele.com
Programmation, Support technique
Jetumele Communications inc.
^ permalink raw reply [nested|flat] 8+ messages in thread
* Re: \copy...
@ 2000-06-20 16:56 Webb Sprague <wsprague100@yahoo.com>
0 siblings, 0 replies; 8+ messages in thread
From: Webb Sprague @ 2000-06-20 16:56 UTC (permalink / raw)
To: Ed <ed@jetumele.com>; pgsql-sql
Finally--a question I think I can answer!
You need to specify what delimiters you use in your
.dat file; the default for COPY is tab, but you can
change that to | with
copy tablename from '/home/ed/import.dat'
delimiters '|'
Hope this works...(oops--I mean 'helps')
--- Ed <ed@jetumele.com> wrote:
> Hi,
>
> I have a file that look like this :
>
> firstname|lastname|email@domain.com
> firstname2|lastname2|email2@domain.com
>
> and a table foo like :
>
> firstname varchar(30),
> lastname varchar(30),
> email varchar(50)
>
> and I would like to do a :
>
> copy tablename from '/home/ed/import.dat';
>
> But then, everything goes in the first field... what
> does i'm doing
> wrong?!?!
>
> Frédéric Boucher
> Ed@jetumele.com
> Programmation, Support technique
> Jetumele Communications inc.
>
>
__________________________________________________
Do You Yahoo!?
Send instant messages with Yahoo! Messenger.
http://im.yahoo.com/
^ permalink raw reply [nested|flat] 8+ messages in thread
* Re: \copy...
@ 2000-06-20 23:37 Christopher Sawtell <csawtell@xtra.co.nz>
parent: Ed <ed@jetumele.com>
0 siblings, 0 replies; 8+ messages in thread
From: Christopher Sawtell @ 2000-06-20 23:37 UTC (permalink / raw)
To: Ed <ed@jetumele.com>; pgsql-sql
On Fri, 16 Jun 2000, Ed wrote:
> Hi,
>
> I have a file that look like this :
>
> firstname|lastname|email@domain.com
> firstname2|lastname2|email2@domain.com
>
> and a table foo like :
>
> firstname varchar(30),
> lastname varchar(30),
> email varchar(50)
>
> and I would like to do a :
>
> copy tablename from '/home/ed/import.dat';
>
> But then, everything goes in the first field... what does i'm doing
> wrong?!?!
You are nearly there, use:-
copy tablename from '/home/ed/import.dat' using delimiters '|';
see sql-copy.htm in online doco.
--
Sincerely etc.,
NAME Christopher Sawtell - iOpen Technologies Ltd.
CELL PHONE 021 257 4451
ICQ UIN 45863470
EMAIL chris @ iopen . co . nz, csawtell @ xtra . co . nz
WWW http://www.iopen.co.nz
CNOTES ftp://ftp.funet.fi/pub/languages/C/tutorials/sawtell_C.tar.gz
-->> Please refrain from using HTML or WORD attachments in e-mails to me <<--
^ permalink raw reply [nested|flat] 8+ messages in thread
* Copy
@ 2001-04-30 21:53 John Coers <coers@intrinsity.com>
0 siblings, 1 reply; 8+ messages in thread
From: John Coers @ 2001-04-30 21:53 UTC (permalink / raw)
To: pgsql-general@postgresql.org
Does a COPY FROM block? In case I am using the wrong terminology,
what I need to know is if I have multiple clients performing COPY FROM...PQputline()
using asynchronous connections, will I lose data? Will the server simply execute
them serially?
^ permalink raw reply [nested|flat] 8+ messages in thread
* Re: Copy
@ 2001-04-30 22:16 Tom Lane <tgl@sss.pgh.pa.us>
parent: John Coers <coers@intrinsity.com>
0 siblings, 2 replies; 8+ messages in thread
From: Tom Lane @ 2001-04-30 22:16 UTC (permalink / raw)
To: coers@intrinsity.com; +Cc: pgsql-general@postgresql.org
John Coers <coers@intrinsity.com> writes:
> Does a COPY FROM block? In case I am using the wrong terminology,
> what I need to know is if I have multiple clients performing COPY FROM...PQputline()
> using asynchronous connections, will I lose data?
No.
> Will the server simply execute them serially?
They'll be executed in parallel, just the same as if each client had
done a bunch of INSERTs wrapped in a BEGIN/END block. You'd only see
problems if clients inserted conflicting data (eg, identical keys in
a column with a UNIQUE index). You may care to read the documentation
about multi-version concurrency control and locking.
regards, tom lane
^ permalink raw reply [nested|flat] 8+ messages in thread
* Re: Copy
@ 2001-05-01 15:49 John Coers <coers@intrinsity.com>
parent: Tom Lane <tgl@sss.pgh.pa.us>
1 sibling, 0 replies; 8+ messages in thread
From: John Coers @ 2001-05-01 15:49 UTC (permalink / raw)
To: Tom Lane <tgl@sss.pgh.pa.us>; +Cc: pgsql-general@postgresql.org
Tom Lane wrote:
>
> John Coers <coers@intrinsity.com> writes:
> > Does a COPY FROM block? In case I am using the wrong terminology,
> > what I need to know is if I have multiple clients performing COPY FROM...PQputline()
> > using asynchronous connections, will I lose data?
>
> No.
>
> > Will the server simply execute them serially?
>
> They'll be executed in parallel, just the same as if each client had
> done a bunch of INSERTs wrapped in a BEGIN/END block. You'd only see
> problems if clients inserted conflicting data (eg, identical keys in
> a column with a UNIQUE index). You may care to read the documentation
> about multi-version concurrency control and locking.
>
> regards, tom lane
hmmmm...I get best performance with N=2 and force the clients to keep trying to
get a connection. If I leave the default of N=32 the machine gets bogged down
to a complete standstill by 32 copies of 15k rows of data. The CPU doesn't seem
stressed -- what may be causing the bottleneck?
--
John Coers Intrinsity, Inc.
coers@intrinsity.com Austin, Texas
^ permalink raw reply [nested|flat] 8+ messages in thread
* Re: Copy
@ 2001-05-01 22:05 John Coers <coers@intrinsity.com>
parent: Tom Lane <tgl@sss.pgh.pa.us>
1 sibling, 0 replies; 8+ messages in thread
From: John Coers @ 2001-05-01 22:05 UTC (permalink / raw)
To: Tom Lane <tgl@sss.pgh.pa.us>; +Cc: pgsql-general@postgresql.org
Tom Lane wrote:
>
> John Coers <coers@intrinsity.com> writes:
> > Does a COPY FROM block? In case I am using the wrong terminology,
> > what I need to know is if I have multiple clients performing COPY FROM...PQputline()
> > using asynchronous connections, will I lose data?
>
> No.
>
> > Will the server simply execute them serially?
>
> They'll be executed in parallel, just the same as if each client had
> done a bunch of INSERTs wrapped in a BEGIN/END block. You'd only see
> problems if clients inserted conflicting data (eg, identical keys in
> a column with a UNIQUE index). You may care to read the documentation
> about multi-version concurrency control and locking.
Do I need to do a PQconnectStart(),PQconnectPoll connection to make the server process
the COPY's in parallel, or does that just affect the client-side thread? How about a
PQconnectdb() and then PQsetnonblocking()?
Can I just do a PQconnectdb()?
I am unclear on how these different connection types affect the client threads vs. the server threads.
--
John Coers Intrinsity, Inc.
coers@intrinsity.com Austin, Texas
^ permalink raw reply [nested|flat] 8+ messages in thread
* COPY
@ 2003-11-17 15:32 ritchie turner <ritchie@ipowerhouse.com>
0 siblings, 0 replies; 8+ messages in thread
From: ritchie turner @ 2003-11-17 15:32 UTC (permalink / raw)
To: pgsql-sql
Hi all
I'm trying to optimise some sql inserts I have by using the COPY command
instead. I'm connecting from Java using 7.4 beta 3. It works at the command
line, but I can't get it to work from Java.
Here's the pg log output.
LOG: query: COPY bingo_cards (account_id, game_id, win_ball, card,
current_call, state) FROM stdin with delimiter '|';
34|50558|75|3,7,8,4,12,23,18,24,22,21,38,45,42,39,43,55,54,53,51,46,70,66,71,75,65|0|0
34|50558|68|4,8,2,13,11,26,23,30,19,18,39,35,31,36,43,55,60,48,59,58,72,68,65,71,66|0|0
34|50558|72|15,11,2,4,5,26,18,20,25,27,43,36,45,38,31,54,57,58,55,50,66,73,71,72,69|0|0
\.
ERROR: syntax error at or near "34" at character 108
Thanks for any help
Ritchie
^ permalink raw reply [nested|flat] 8+ messages in thread
end of thread, other threads:[~2003-11-17 15:32 UTC | newest]
Thread overview: 8+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2000-06-15 18:32 \copy... Ed <ed@jetumele.com>
2000-06-20 23:37 ` Christopher Sawtell <csawtell@xtra.co.nz>
2000-06-20 16:56 Re: \copy... Webb Sprague <wsprague100@yahoo.com>
2001-04-30 21:53 Copy John Coers <coers@intrinsity.com>
2001-04-30 22:16 ` Re: Copy Tom Lane <tgl@sss.pgh.pa.us>
2001-05-01 15:49 ` Re: Copy John Coers <coers@intrinsity.com>
2001-05-01 22:05 ` Re: Copy John Coers <coers@intrinsity.com>
2003-11-17 15:32 COPY ritchie turner <ritchie@ipowerhouse.com>
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