On 16 Nov 2012, at 11:26pm, 杨苏立 Yang Su Li <yangs...@gmail.com> wrote:
> I want to measure the execution time of each sql statement in sqlite. > > I understand in sqlite shell you could just do .timer on, but I am > wondering how to do it in a pogrammerable way so that I could know how much > time a sql statement takes when applications are accessing the database at > real time, not just by replaying that statement in a shell afterwards? > > Could I just provide a plugin function for sqlite_profile? While you can use the built-in functions to do this, as Kyan showed you, it is more accurate to do it in your own programming language, since those times will include the overhead for calling the SQLite functions and handling memory. If you are calling the raw C API functions that overhead is low, but if you are using an object-oriented library it can be high. If your language has a 'get time of day as a number' function then you can just use that before and after each SQLite call and subtract one from another. Simon. _______________________________________________ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users