Re: mysql slow inserts with innodb



discussion and work around are discussed in the comp.lang.perl.misc
forum:

http://groups.google.com/group/comp.lang.perl.misc/browse_thread/thread/cfadcc7a1c1d748f

rickyars@xxxxxxxxx wrote:
i'm trying to insert 500k rows into a table from a comma separated text
file. unfortunately i cannot do a load data because i also need to
insert some foreign keys from another table. the following code takes
a little over 4 hours to do the insert.

several questions: is there anything glaringly wrong with my code?
please ignore typos, i removed some stuff to make it more readable.
how do i do multi value inserts in perl (i.e. 10k rows with a single
INSERT statement)?

my $select_handle =
$dbh->prepare('SELECT agent_id, agent_fullname FROM agents WHERE
agent_shortname = ? AND RDEOUTPUT_rde_id = ?');
my $insert_handle =
$dbh->prepare('INSERT INTO actual VALUES
(DEFAULT,?,?,?,?,?,?,?,?,?)');

while (<$GTRUTH>) {
chomp;
my @gtruth = split;

$select_handle->execute($gtruth[3],$rde_id);
my ($AGENTS_agent_id, $agent_fullname) = $select_handle->fetchrow;

$insert_handle->execute($AGENTS_agent_id,$rde_id,$gtruth[0],0,$gtruth[7],$gtruth[8]);
}

.