sampwing
sampwing

Reputation: 1268

Determining execution time of queries in SQLite

I am creating a program for analyzing and generating queries. I was curious if there currently exists a method within SQLite such that I could query the time taken for a query to process? I am unable to modify my install in any way, so this method needs to work out of the box. I am writing my tool in python, and although I guess I could use the timer class to time execution -this method will not work when I am connecting to remote machines (and return a consistent timing.)

Upvotes: 29

Views: 13493

Answers (1)

Tim
Tim

Reputation: 4813

From within the sqlite3 command-line program you can do:

.timer ON
select * from my_table;

This will print the CPU time taken for the query.

Upvotes: 64

Related Questions