Things (about MySQL) my father never told me...

Just discovered one of those things I should have discovered a long, long time ago: in MySQL (and, I assume, every-other-SQL), this:

insert into table (field1,field2,field3) values (1,2,3)
insert into table (field1,field2,field3) values (4,5,6)
insert into table (field1,field2,field3) values (7,8,9)

…can also be expressed like this:

insert into table (field1,field2,field3) values 
                  (1,2,3),
                  (4,5,6),
                  (7,8,9)

The difference is that the second form, especially if you’ve got lots of inserts to do, is much, much faster.

Comments

Add new comment

Plain text

  • Allowed HTML tags: <b> <i> <em> <strong> <blockquote> <code> <ul> <ol> <li>
  • Lines and paragraphs break automatically.

About This Blog

Photo of Peter RukavinaI am . I am a writer, letterpress printer, and a curious person.

To learn more about me, read my /nowlook at my bio, read presentations and speeches I’ve written, or get in touch (peter@rukavina.net is the quickest way). You can subscribe to an RSS feed of posts, an RSS feed of comments, or receive a daily digests of posts by email.

Search