Michael Scharf wrote:
Eric Bohlman wrote:

Using prepared statements with placeholders would reduce the amount of parsing even further.


Well, I think
  INSERT INTO tablename VALUES (0,'foo') , (1,'bar') , (2,'baz');

is a kind of prepared statement, or it could be implemented as
a prepared statement. How would a prepared statemnt reduce the
amout of parsing significantly?

(1,2),  -- the overhead is 2 charactes per statement the '(' and
        -- the ')'

The data part of a prepared statement could drop the () but it
would need a separation character for columns ane one for rows.
You coul you use ',' and ';'.

The nice thing about the "row value constructors", is that it is
an (optional) part of SQL....

The point is that a prepared statement (INSERT INTO tablename VALUES (?,?);) is parsed and translated into a VDBE program only once. Each time you bind values to it and call sqlite3_step(), you're simply invoking the already-created VDBE program. With your proposal, each set of values to be inserted has to be parsed and translated into VDBE code.

Reply via email to