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" <[EMAIL PROTECTED]>
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.


-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:    http://lists.mysql.com/[EMAIL PROTECTED]

Reply via email to