Get the latest tech news
Why SQLite Uses Bytecode
Every SQL database engine works in roughly the same way: It first translates the input SQL text into a "prepared statement". Then it "executes" the prepared statement to generate a result.
When problems arise (incorrect answers and/or poor performance), the developers can examine the bytecode to quickly isolate the source of the trouble to either the front-end analysis or the back-end data storage sections of the product. To pause the statement in the middle of a computation means unwinding the stack back up to the caller, all the while saving enough state to resume evaluation where it last left off. Emphasis on "believe" in the previous sentence → it is difficult to verify this claim experimentally since nobody has ever put in the multiple years of effort necessary to generate equivalent bytecode and tree-of-object representations of a prepared statement to see which one really does run faster.
Or read this on Hacker News