List:General Discussion« Previous MessageNext Message »
From:Gabriel PREDA Date:April 1 2005 9:09am
Subject:Re: How does a multi-row INSERT work?
View as plain text  
Ok. I believe you got your answer... for the syntax...

I just want to add that this is faster because... using this you only modify
the index file once.

Lets see for:
    INSERT INTO x VALUES (a,b);
    INSERT INTO x VALUES (c,d);

The server does:
    open table
    INSERT INTO x VALUES (a,b);
    update index
    close table
    open table
    INSERT INTO x VALUES (c,d);
    update index
    close table

But for
    INSERT INTO x VALUES (a,b),(c,d);
The server does:
    open table
    INSERT INTO x VALUES (a,b),(c,d);
    update index
    close table

Now it's clear why multi-row INSERT is faster.

Of course THIS IS a faulty explanation ("grosso modo" in latin) but show
somehow what's going on !

Gabriel PREDA

----- Original Message ----- 
From: "Chris W. Parker" <cparker@stripped>
Subject: How does a multi-row INSERT work?
> Hello,
> I searched the archives, looked through the manual, and searched google
> for info on how to actually perform a multi-row INSERT but didn't find
> an answer.
> Would someone please show me the syntax for this please?
> I could just do a loop and INSERT the data that way but according to the
> manual, a multi-row INSERT is faster.
> Thanks,
> Chris.

Thread
How does a multi-row INSERT work?Chris W. Parker31 Mar
  • Re: How does a multi-row INSERT work?Jonathan Wright31 Mar
  • Re: How does a multi-row INSERT work?Dan Nelson31 Mar
    • Re: How does a multi-row INSERT work?SGreen31 Mar
  • Re: How does a multi-row INSERT work?John McCaskey31 Mar
  • Re: How does a multi-row INSERT work?Rhino1 Apr
  • Re: How does a multi-row INSERT work?Gabriel PREDA1 Apr
RE: How does a multi-row INSERT work?Chris W. Parker31 Mar
Re: How does a multi-row INSERT work?beacker31 Mar