pySQLite Insert speed

Steve Holden steve at holdenweb.com
Fri Feb 29 09:37:38 EST 2008


mdboldin at gmail.com wrote:
>> (B) is better than (A). The parameter binding employed in (B)
>> is not only faster on many databases, but more secure.
> See, for example,http://informixdb.blogspot.com/2007/07/filling-in-
> blanks.html
> 
> Thx.  The link was helpful, and I think I have read similar things
> before-- that B is faster.
> So ... I just rewrote the test code from scratch and B is faster. I
> must have had something wrong in my original timing.

Don't forget, by the way, that your original (B) code was performing the 
string substitution of the parameter markers into the SQL statement each 
time the statement was executed. As Carsten pointed out, this overhead 
should be performed at most once, and only then if you want your code to 
be portable over database backends with different paramstyles. Forget (A).

regards
  Steve
-- 
Steve Holden        +1 571 484 6266   +1 800 494 3119
Holden Web LLC              http://www.holdenweb.com/




More information about the Python-list mailing list