Sqlite3. Substitution of names in query.

L

Lawrence D'Oliveiro

Carsten said:
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?
 
L

Lawrence D'Oliveiro

Dennis Lee said:
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.
 
C

Carsten Haese

Lawrence said:
I wonder about the veracity of your claims, because:


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.
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,014
Latest member
BiancaFix3

Latest Threads

Top