Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Python > Re: MySQLdb

Reply
Thread Tools

Re: MySQLdb

 
 
Daniel Bowett
Guest
Posts: n/a
 
      01-26-2005
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.

 
Reply With Quote
 
 
 
 
George
Guest
Posts: n/a
 
      01-28-2005
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
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
using like and % in MySQLdb Dave Harrison Python 0 08-07-2003 04:43 AM
MySQLdb and egenix mxDateTime dumps core Dave Harrison Python 0 08-05-2003 10:49 PM
Python2.3 and MySQLdb on Windows Mike M Python 1 07-31-2003 08:52 AM
Re: Problem with MySQLdb on Mac OS X... Skip Montanaro Python 5 07-16-2003 04:46 AM
can't import MySQldb on OS X Alan Little Python 0 06-25-2003 09:46 PM



Advertisments