-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On 30/03/12 01:45, TeDe wrote:
> We 've been using profilers for Sybase and MySQL, where you can see a 
> lot more: index usage, number of page reads, returning rows and time - 
> for the whole query and for every subquery.

Note that SQLite runs as a library within your process so you can use
whatever tools are normal for your platform.  For example on Linux/Unix
you can use getrusage - here is the man page:

  http://linux.die.net/man/2/getrusage

Windows doesn't have an API with all that info in one place, but you can
find APIs for subsets such as GetProcessTimes to get timing information.

One gotcha is that SQLite only does enough calculations to get the next
result row when you call sqlite3_step.  For example if you called "select
* from large_table" then sqlite3_step does virtually no work each time you
call it.  You can address this by wrapping sqlite3_step and saving before
and after values and then accumulate them until finalize/reset.

SQLite itself also has some instrumentation which you can get using these
calls:

  http://www.sqlite.org/c3ref/db_status.html
  http://www.sqlite.org/c3ref/stmt_status.html

Finally you can also use EXPLAIN (not EXPLAIN QUERY PLAN) information.  To
a first approximation, the more longer the resulting output the more steps
are being taken and the more complex your query is, so you should try to
keep them short.

Roger
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.11 (GNU/Linux)

iEYEARECAAYFAk92Fw8ACgkQmOOfHg372QS84wCgrU9STHsDtKQkDX4IHF3Eqlhl
k1kAnjycDBBQaHiyk95Rp6AaD9DSvelP
=oRXe
-----END PGP SIGNATURE-----
_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to