3 ms·
That -is- fast, but I still have trouble reconciling that deep down in my computer, a human readable SQL query gets built, and then another process parses that
by gstar 17y ago
That -is- fast, but I still have trouble reconciling that deep down in my computer, a human readable SQL query gets built, and then another process parses that SQL. Seems so wasteful building and then parsing a human readable string for something that's happening on the same machine.
I know nothing of SQLites's internals, but wouldnt it make more sense to parse the query once and then store a compiled version of the query for subsequent lookups? Like you might do with a regexp?
- azim 17y agoYes, This is known as a prepared statement. You compile a parametrized statement once, then execute it as many times as you like with different arguments. Also, SQLite, unlike most other databases, is an embedded database which does everything in-process rather than invoking multiple processes.