On 02/12/2016 03:47 PM, Michele Pradella wrote: > Hi all, is there a way to make a benchmark of queries to check which > version is faster? I'm using sqlite shell, the question is about on > how to make repetitive tests in the same conditions (for example I > need to totally disable cache to avoid different results the second > time query is executed). > I try to explain better: the same query re-arranged in two different > queries to check which is the faster, executed on the same DB, how can > I do speed check of those queries avoiding interaction between two > queries(example cache)?
One way to look at performance of an SQLite query is to say that it is influenced by three factors: the amount of IO, the number and size of malloc() calls made and the CPU consumed by the library to run the query. Adding the -stats option to the shell tool command line causes it to output some helpful information after running each query. Including page cache hits and misses. And some stuff about malloc() usage. We usually use the valgrind tool callgrind or cachegrind to repeatably measure CPU load here. Dan.

