You don't say how many cores you have but I assume more than 4. If you're just single or dual-core I'd say this isn't too surprising.
It's pretty rare that multi-threading gives an N*X performance boost -- especially for CPU or disk bound processes. Simon said most of the reasons but also forgot CPU cache. If you time the 1,2,3,4 thread versions individually you'll see the curve of your effort instead of a straight line. The more threads you add the less %-per-thread improvement you'll see. It sounds like you're hitting disk thrashing though. Try increasing your cache size on the database. pragma cache_size=2000 is the default pragma_page_size; // will tell you how big the pages are cache*page=total cache size // so you probabliy have 2MB of cache -- how big is your database? 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 Maddy [im4frie...@gmail.com] Sent: Thursday, February 24, 2011 3:52 AM To: sqlite-users@sqlite.org Subject: EXT :[sqlite] Parallel execution of queries in threads Hi, I have 4 "SELECT" queries which are accessing same table. When I executed these queries concurrently using pthreads in Linux, it took approximate 10 Seconds. But same 4 queries executed sequentially it only took 2 seconds. Total Rows in table are 100000. Sample query is "SELECT column1, sum(column2) from TABLE_NAME;" What can be the reason behind this? Thanks, Madhav _______________________________________________ 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