News for hackers. Stuff that matters.
Re:Why SQLite succeeded as a database (2016) by jessermeyer on Wednesday February 19, 2020 @02:28PM (#22369095)
I know SQLite's SQL query engine is implemented as a VM. Are there ways of optimizing repeated queries, similar to compiling a query to avoid the VM churn? Perhaps more importantly, have you ever been disappointed by the query engine's performance?
Re:Why SQLite succeeded as a database (2016) by nbevans on Wednesday February 19, 2020 @03:41PM (#22369825)
You can "prepare" a SQL statement and use it multiple times. I.e. you can use the same VM for a statement many times.
Re:Why SQLite succeeded as a database (2016) by zzo38computer on Thursday February 20, 2020 @01:03AM (#22373045)
You can prepare a query to use multiple times (if you are using the C interface, at least; as far as I know the command-line interface does not support this), as another comment mentions. You can also prefix a SQL statement by EXPLAIN to view the VDBE codes. But, I see that sometimes the VDBE code is not as good as it should be.
Re:Why SQLite succeeded as a database (2016) by kccqzy on Wednesday February 19, 2020 @10:20PM (#22372428)
You can put each query and the result of preparing that query into an LRU cache (or even just a static pointer in C if your application only ever deals with a single connection). Then you can reuse these without preparing them over and over.