You need to show us exactly what you're doing....it's not clear.... reboot (please wait for disk to settle after login). sqlite3 dba .timer on select count(id) from tab1; -- database not cached in OS or in sqlite3 select count(id) from tab1; -- this will be faster as the database is cached inside sqlite3 .quit sqlite3 dba select count(id) from tab1; -- this should be faster than the 1st time above as the file is cached in the OS now select count(id) from tab1; -- this should be the same speed as the 2nd time from the previous run and should be faster than the 1st select of this run .quit
And if you repeat this sequence for another databse you should see exactly the same results as the first database as they are not related at all. sqlite3 dbb .timer on select count(id) from tab1; select count(id) from tab1; -- this will be faster as the database is cached inside sqlite3 .quit sqlite3 dba select count(id) from tab1; -- this should be faster than the 1st time above as the file is cached in the OS now select count(id) from tab1; -- this should be the same speed as the 2nd time from the previous run and should be faster than the 1st select of this run Michael D. Black Senior Scientist NG Information Systems Advanced Analytics Directorate From: sqlite-users-boun...@sqlite.org [sqlite-users-boun...@sqlite.org] on behalf of 徐 [okd...@126.com] Sent: Monday, September 05, 2011 3:12 AM To: sqlite-users@sqlite.org Subject: EXT :Re: [sqlite] select speed is too slow > For eg, the query like this: "select count(id) from tab1" ,and the > record number is above 100,000. If i can't restart my pc, the > speed is quicker when i do the second query. >>This must be because the OS cached your database file into memory. thanks forSébastien Escudier's reply. but I am comfused that: First time i used sqlite database A for query, and second time database B, and then the second query speed of another database (B) is still faster. :( _______________________________________________ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users _______________________________________________ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users