Re: insert analogue to dbload?
Posted in 1994
Joe Lumbley (jlumbley@netcom.com) wrote:
: Has anyone seen a utility that does an "insert into table1 select * from
: table2 where XXXXXXXX" in the same manner that dbload loads from flatfiles?
: I'm trying to reduce the danger of lock table overflow on inserts and to
: reduce the possibility of logfile fillup on a long transaction.
: Specifically, I'd like to have control over the commit interval ala
: dbload -n and would like to run it from the command line. Sounds like a
: program that lots of people could use. Being the lazy programmer that
: I am, I wanted to see if anyone else had invented this wheel before I
: try to write it.
I'll follow up on my own post with something that may be helpful. Thanks
to Ed Hobbs for his post on named pipes (fifo) that, although having nothing
to do with my post, set me in the right direction.
It's possible to use a named pipe to unload a table and immediately load it
using dbload. Much faster than using real disks and has all the benefits of
using dbload.
Use:
mkfifo named_pipe
on one terminal, go into SQL (or dbaccess) and:
unload to named_pipe select * from source_table;
(or just put the ISQL/dbaccess in the background)
On another terminal, create a dbload control file like this:
FILE named_pipe DELIMITER "|" number_of_columns;
INSERT INTO target_table;
then do a dbload:
dbload -d database_name -c control_file_name -l error_log_name
This only works if your version of Unix supports the mkfifo named
pipe command.
--
===========================================================================
jlumbley@netcom.com (Joe Lumbley)
BancTec Service Corportation 214-450-9894
Dallas, Texas
Watch for my _INFORMIX DBA SURVIVAL GUIDE_ in Fall '94 from Prentice Hall!
===========================================================================