Skip site navigation (1) Skip section navigation (2)

Re: COPY (query) TO file

From: PFC <lists(at)peufeu(dot)com>
To: pgsql-hackers(at)postgresql(dot)org
Subject: Re: COPY (query) TO file
Date: 2006-06-03 14:59:29
Message-ID: op.takrxfn7cigqcu@apollo13 (view raw or flat)
Thread:
Lists: pgsql-hackers

>> 	MySQL already does this for INSERT :
>> 	INSERT INTO x (a,b) VALUES (1,2), (3,4), (5,6)...;
>
> Does MySQL really let you stream that? Trying to do syntax like that in
> Postgres wouldn't work because the parser would try to build up a parse  
> tree
> for the whole statement before running the command.

	Hehe, I don't know, but I suppose it's parsed in one-shot then executed,  
and not streamed, because :
	- you can append modifiers at the end of the statement (IGNORE...),
	- mysql barfs if the complete SQL including data is larger than the query  
buffer specified in the config file.

	The second point leads to an interesting fact, ie. dumps generated by  
phpmyadmin and mysqldump need a parameter specifying how long, in bytes,  
the insert commands can be ; so that hopefully they can be reloaded later.
	If one of the inserted values violates a "constraint", it is substituted  
by "some other default value".

	Still, it's useful ; and one interesting part is that everything happens  
in the same SQL command (wrt concurrency).


In response to

pgsql-hackers by date

Next:From: PFCDate: 2006-06-03 15:12:14
Subject: Faster Updates
Previous:From: Tom LaneDate: 2006-06-03 14:56:44
Subject: Re: COPY (query) TO file

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group