Re: MySQLdb

Discussion in 'Python' started by Daniel Bowett, Jan 26, 2005.

  1. Daniel Bowett wrote:
    > I have just started playing around with MySQLdb for a project I am
    > planning.
    >
    > As a test I have written a script that executes 3000 insert statements
    > on a table. The table contains 10 fields with a mix of text and numbers
    > - its a product table for a website eg UPC, ProductName, Price etc.
    >
    > The problem I have is that it takes just over two minuted to execute the
    > 3000 insert statements which seems really slow! I am running it on a
    > machine with a 1.5 Ghz Pentium M Processor and Gig Of Ram. I dont think
    > the machine is to blame for the speed because during execution the
    > processor sits at about 10% and there is loads of free RAM.
    >
    > Does anyone know if this sort of speed sounds right?
    >
    > Cheers,
    >
    > Dan.
    >
    >


    UPDATE
    ------

    I have found the "executemany" function! It now takes around a second to
    complete the 3000 inserts.

    Lesson learnt - I should have posted my code...

    Thanks for your help everyone.
     
    Daniel Bowett, Jan 26, 2005
    #1
    1. Advertising

  2. Daniel Bowett

    George Guest

    Daniel Bowett wrote:

    > Daniel Bowett wrote:
    >> I have just started playing around with MySQLdb for a project I am
    >> planning.
    >>
    >> As a test I have written a script that executes 3000 insert statements
    >> on a table. The table contains 10 fields with a mix of text and numbers
    >> - its a product table for a website eg UPC, ProductName, Price etc.
    >>
    >> The problem I have is that it takes just over two minuted to execute the
    >> 3000 insert statements which seems really slow! I am running it on a
    >> machine with a 1.5 Ghz Pentium M Processor and Gig Of Ram. I dont think
    >> the machine is to blame for the speed because during execution the
    >> processor sits at about 10% and there is loads of free RAM.
    >>
    >> Does anyone know if this sort of speed sounds right?
    >>
    >> Cheers,
    >>
    >> Dan.
    >>
    >>

    >
    > UPDATE
    > ------
    >
    > I have found the "executemany" function! It now takes around a second to
    > complete the 3000 inserts.
    >
    > Lesson learnt - I should have posted my code...
    >
    > Thanks for your help everyone.


    Hi Daniel,

    I was just wondering the executemany sends the insert as batch, does it?
    That is what I was going to suggest for speed MySQL should process this
    very quickly as a batch the problem was probably getting them there.

    Regards,
    George
     
    George, Jan 28, 2005
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Alan Little

    can't import MySQldb on OS X

    Alan Little, Jun 25, 2003, in forum: Python
    Replies:
    0
    Views:
    846
    Alan Little
    Jun 25, 2003
  2. Skip Montanaro

    Re: Problem with MySQLdb on Mac OS X...

    Skip Montanaro, Jul 12, 2003, in forum: Python
    Replies:
    5
    Views:
    392
    Michael S. Jessop
    Jul 16, 2003
  3. Mike M
    Replies:
    1
    Views:
    331
  4. Dave Harrison

    MySQLdb and egenix mxDateTime dumps core

    Dave Harrison, Aug 5, 2003, in forum: Python
    Replies:
    0
    Views:
    341
    Dave Harrison
    Aug 5, 2003
  5. Dave Harrison

    using like and % in MySQLdb

    Dave Harrison, Aug 7, 2003, in forum: Python
    Replies:
    0
    Views:
    318
    Dave Harrison
    Aug 7, 2003
Loading...

Share This Page