Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Python > Sqlite3. Substitution of names in query.

Reply
Thread Tools

Sqlite3. Substitution of names in query.

 
 
Lawrence D'Oliveiro
Guest
Posts: n/a
 
      11-03-2009
In message <(E-Mail Removed)>, Carsten
Haese wrote:

> With all due respect, but if your experience is exclusive to
> MySQL/MySQLdb, your experience means very little for database
> programming practices in general.


I wonder about the veracity of your claims, because:

> And here are the corresponding results on my laptop:
> $ python -mtimeit -s "from querytest import Tester; t=Tester()"
> 't.with_params()'
> 10000 loops, best of 3: 20.9 usec per loop
> $ python -mtimeit -s "from querytest import Tester; t=Tester()"
> 't.without_params()'
> 10000 loops, best of 3: 36.2 usec per loop


Didn't you say previously that there should be a "seven orders of magnitude"
difference? What happened to that claim?
 
Reply With Quote
 
 
 
 
Lawrence D'Oliveiro
Guest
Posts: n/a
 
      11-03-2009
In message <(E-Mail Removed)>, Dennis Lee
Bieber wrote:

> On Tue, 03 Nov 2009 09:41:10 +1300, Lawrence D'Oliveiro
> <(E-Mail Removed)_zealand> declaimed the following in
> gmane.comp.python.general:
>
>> There is no such parsing overhead. I speak from experience.
>>

> <snort>
>
>> Look at the BulkInserter class here
>> <http://www.codecodex.com/wiki/Useful_MySQL_Routines>. I have
>> successfully used that to insert tens of thousands of records in just a
>> few seconds. Yet it makes no use of the parameter-substitution provided
>> by MySQLdb; it is all

>
> You picked the wrong database to use for your argument.


I would say "that is precisely my point", but I'll be kind and give you a
chance: pick another database, if you think that will make your point
better.
 
Reply With Quote
 
 
 
 
Carsten Haese
Guest
Posts: n/a
 
      11-03-2009
Lawrence D'Oliveiro wrote:
> In message <(E-Mail Removed)>, Carsten
> Haese wrote:
>
>> With all due respect, but if your experience is exclusive to
>> MySQL/MySQLdb, your experience means very little for database
>> programming practices in general.

>
> I wonder about the veracity of your claims, because:
>
>> And here are the corresponding results on my laptop:
>> $ python -mtimeit -s "from querytest import Tester; t=Tester()"
>> 't.with_params()'
>> 10000 loops, best of 3: 20.9 usec per loop
>> $ python -mtimeit -s "from querytest import Tester; t=Tester()"
>> 't.without_params()'
>> 10000 loops, best of 3: 36.2 usec per loop

>
> Didn't you say previously that there should be a "seven orders of magnitude"
> difference? What happened to that claim?


"That claim" was an exaggeration I resorted to after you distorted the
concept of choosing the right tool for the job into premature
optimization. It wasn't my initial claim.

The "seven orders" (which is actually log-10 orders of however often the
same query is executed with different values) is of course only the cost
increase on parsing the query itself, which as you pointed out is
drowned out by other fixed costs associated with performing database
queries. However, you can't dispute the fact that using string
interpolation *is* in general less efficient than parameter binding, and
that was my initial claim.

--
Carsten Haese
http://informixdb.sourceforge.net

 
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
Converting 'flat' gate level names to hierarchical names Paddy McCarthy VHDL 3 09-24-2004 05:34 PM
table field names vs. display names Bob ASP .Net 1 07-30-2004 05:06 PM
Matching attribute names to element names in a different path Carl XML 0 04-01-2004 01:15 PM
WSDL- Mapping Application Defined Names to XML Names Craig XML 0 02-09-2004 04:14 PM
XSL rules applying to XSD (XML schema) defined type names (as opposed to node names) Lewis G. Pringle, Jr. XML 0 09-30-2003 10:34 PM



Advertisments