On 8 Jan 2018, at 8:42pm, Shane Dev <devshan...@gmail.com> wrote: > Do you mean it would be more efficient to generate entries such as these > (with randomly chosen integers and running numbers) in the application and > then committing them to the database with sqlite3_exec or similar?
There’s the question of understanding and debugging the code. It’s possible to do strange and complicated things entirely in SQLite. Especially with RCTEs and triggers. But when you see things like num+1, cast(round(abs(random())/9223372036854775808) as int) from you’ve probably looking at sanity in the rear view mirror. Suppose someone has to read your code and figure out what it’s meant to do. If you expect your code to be read by others, the amount of documentation you'll have to write takes longer than writing the software properly. > For a large number of entries, I assumed there would be greater overhead in > preparing and binding the values than both generating and storing them with > a single RCTE. SQLite is just software written in C. There’s no reason to believe it’ll be any more efficiently than your own C code. Even your respect for the SQLite development team shouldn’t outweigh the advantage of working with code you write yourself. How low do you need the overhead to be ? Have you tried a simple solution and found it takes an unacceptable time ? Did you get complaints from your customers ? You can spend two days writing complicated code which shaves 45 milliseconds off your execution time. Code which is difficult to debug and too complicated for other people to understand. Or you could spend those two days adding a useful function to your program. Or lying on a beach. Simon. _______________________________________________ sqlite-users mailing list sqlite-users@mailinglists.sqlite.org http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users