Sqlite3. Substitution of names in query.

Carsten Haese carsten.haese at gmail.com
Sun Nov 1 23:40:11 CET 2009

Lawrence D'Oliveiro wrote:
> Says someone who hasn't realized where the real inefficiencies are. Remember 
> what Tony Hoare told us: "premature optimization is the root of all evil". 
> These are databases we're talking about. Real-world databases are large, and 
> reside on disk, which is several orders of magnitude slower than RAM. And 
> RAM is where string parameter substitutions take place. So a few hundred 
> extra RAM accesses isn't going to make any significant difference to the 
> speed of database queries.

You're just not getting it. The cost is not in performing the parameter
substitutions themselves. The cost is in parsing what's essentially the
same query one million times over when it could have been parsed only
once. You might find an increase of seven orders of magnitude
insignificant, but I don't.

> Probably why I don't use Informix. What use is a binary data type if you 
> can't insert and retrieve binary data values?

You CAN insert and retrieve binary data values. You just have to use the
right tool for the job, and that is parameter binding.

Carsten Haese

More information about the Python-list mailing list