On Tue, 2008-12-02 at 18:01 +0100, Davide Sacchetti wrote: > I need to fetch data from two different database (A and B). > > I wrote a sequential code fetching from A and, after the fetch is > finished, from B. > Then I tried to use threads: I splitted the fetches into 2 threads: > each > one makes its own connection to A or B and fetches his data. > Apparently the threaded code works but the fetches are slower (about > half) compared to the sequential code. > > Is it a known issue or am I doing something wrong? > Thanks for any hint ... >
You are doing nothing wrong. Unless your OS supports running threads on different processors, threading will be slower than sequential processing. If your databases are on the same disk, trying to access them simultaneously will slow the access and cause greater slow downs than threading. -- Just my 0.00000002 million dollars worth, Shawn The key to success is being too stupid to realize you can fail.
