Re: [sqlite] sqlite_exec query string maximum length?
Hello, Thanks for the explaination. Looks like this isn't going to help me after all. Thought sqlite3_exec() would compile the query only once. Best regards, Kervin --- Dennis Cote <[EMAIL PROTECTED]> wrote: > Kervin L. Pierre wrote: > > and for performance, I would like to execute as > > few sqlite_exec() calls as possible. > > > > > > Kervin, > > While you can pass several SQL statements to > sqlite3_exec in one sql > string, each statement is compiled and executed > separately, so the > performance increase over separate calls to > sqlite3_exec is not > substantial. If you add 1000 inserts into a string > and pass that to > sqlite3_exec, it will repeat the following steps > 1000 times; parse > insert statement sql, generate insert statement, > execute insert > statement, and destroy insert statement. > > However, if you use a prepared statement, and then > simply bind new > values to it for each insert you eliminate the > parse, generate, and > destroy steps for 999 out of the 1000 statements. > This will provide a > much more substantial performance boost. > > Note, it is also extremely important to wrap your > block of inserts with > "begin transaction" and "end transaction" commands. > > HTH > Dennis Cote > > > - > To unsubscribe, send email to > [EMAIL PROTECTED] > - > > - To unsubscribe, send email to [EMAIL PROTECTED] -
Re: [sqlite] sqlite_exec query string maximum length?
Hello, Thanks. Best regards, Kervin --- [EMAIL PROTECTED] wrote: > "Kervin L. Pierre" <[EMAIL PROTECTED]> wrote: > > what is the maximumm number > > of characters there can be in a query > > string sent to sqlite_exec()? > > 2147483647 bytes > > -- > D. Richard Hipp <[EMAIL PROTECTED]> > > > - > To unsubscribe, send email to > [EMAIL PROTECTED] > - > > - To unsubscribe, send email to [EMAIL PROTECTED] -
Re: [sqlite] sqlite_exec query string maximum length?
Kervin L. Pierre wrote: and for performance, I would like to execute as few sqlite_exec() calls as possible. Kervin, While you can pass several SQL statements to sqlite3_exec in one sql string, each statement is compiled and executed separately, so the performance increase over separate calls to sqlite3_exec is not substantial. If you add 1000 inserts into a string and pass that to sqlite3_exec, it will repeat the following steps 1000 times; parse insert statement sql, generate insert statement, execute insert statement, and destroy insert statement. However, if you use a prepared statement, and then simply bind new values to it for each insert you eliminate the parse, generate, and destroy steps for 999 out of the 1000 statements. This will provide a much more substantial performance boost. Note, it is also extremely important to wrap your block of inserts with "begin transaction" and "end transaction" commands. HTH Dennis Cote - To unsubscribe, send email to [EMAIL PROTECTED] -
Re: [sqlite] sqlite_exec query string maximum length?
"Kervin L. Pierre" <[EMAIL PROTECTED]> wrote: > what is the maximumm number > of characters there can be in a query > string sent to sqlite_exec()? 2147483647 bytes -- D. Richard Hipp <[EMAIL PROTECTED]> - To unsubscribe, send email to [EMAIL PROTECTED] -
[sqlite] sqlite_exec query string maximum length?
Hello, My application is building a query string with multiple queries. The number of queries depends on the user and for performance, I would like to execute as few sqlite_exec() calls as possible. So my question what is the maximumm number of characters there can be in a query string sent to sqlite_exec()? ( if there is a maximum defined ). I estimate that the query string would get to 65K characters on occasion, and there is no gaurantee that it won't get to larger once in a while. Best regards, Kervin - To unsubscribe, send email to [EMAIL PROTECTED] -