Results 1 to 2 of 2
  1. #1
    Join Date
    Feb 2005
    Posts
    3

    Unanswered: Slow inserts on .NET

    I use the .NET connector from MySql. And when I use the MySqlCommandBuilder to do insert in my table, it seems to run quite slow. I have a little mor than 1000 rows to insert at one time. Yet it takes approx. two minutes do finish the inserts. This seems quite slow to me.

    Any ideas on how I can get the execution faster??

  2. #2
    Join Date
    Apr 2002
    Location
    Toronto, Canada
    Posts
    20,002
    why not insert several rows at once?

    instead of this --

    insert into mytable (col1, col2, ... colN) values ('val1', val2, ... 'valN')
    insert into mytable (col1, col2, ... colN) values ('val1', val2, ... 'valN')
    insert into mytable (col1, col2, ... colN) values ('val1', val2, ... 'valN')
    insert into mytable (col1, col2, ... colN) values ('val1', val2, ... 'valN')
    ...

    try this --

    insert into mytable (col1, col2, ... colN)
    values ('val1', val2, ... 'valN')
    , ('val1', val2, ... 'valN')
    , ('val1', val2, ... 'valN')
    , ('val1', val2, ... 'valN')
    ...
    rudy.ca | @rudydotca
    Buy my SitePoint book: Simply SQL

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •