MySQLdb

Daniel Bowett daniel at bowettsolutions.com
Wed Jan 26 03:27:34 EST 2005


Dennis Lee Bieber wrote:
> On Tue, 25 Jan 2005 20:43:54 +0000, Daniel Bowett
> <daniel at bowettsolutions.com> declaimed the following in
> comp.lang.python:
> 
> 
>>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.
>>
> 
> 	How many indices?
>  
> 
>>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 
> 
> 
> 	I recall reading that, for some RDBMs, when doing such batch
> inserts, they recommend turning off the indices at the start, do the
> inserts, then reactivate the indices -- apparently it is faster to
> rebuild an index after the data has been inserted, then to continually
> update the index.
> 

UPC is my only index - its a varchar with 20 characters. I am only 
opening the connection once, then doing 3000 execute statements in a for 
loop.

I do have two "TEXT" fields in the table which contain the long and 
short description. The average length of the long description is about 
167 characters, the longest is 1800 characters. Is this whats making it 
slow?




More information about the Python-list mailing list