On 24 Feb 2011, at 9:52am, Maddy wrote: > 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?
This is not /definitely/ the reason for your problem, but it might be. Try having two people look up a name in a phone book at the same time. They get into each-other's way. It's better to let one person use the book first, then the other person. You actually have only one disk drive, one drive controller, one drive cache and one computer. If you have two threads accessing different data at the same time the disk has to keep jumping from one set of data to the other. You only have limited space in your caches, and the data from both threads may be too big to fit in them at the same time. I see a lot of very craft talk about optimisation on this list: multiple threads, separating out one table into many, background writing. A lot of the time it is pointless because behind it all you still only have one disk drive. Simon. _______________________________________________ sqlite-users mailing list [email protected] http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

