[Message also posted to: perl.dbi.users]

[EMAIL PROTECTED] (Davide Sacchetti) wrote:
> Dear users,
> 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.

Does each thread create a new connection for each statement execution?
That could certainly slow things down.

> Is it a known issue or am I doing something wrong?

I don't know what you are doing, I don't see any code, so I have to guess.
Creating short-lived threads in a loop and creating a connection in each
thread would definitely be wrong.

> Thanks for any hint ...

What happens if you arrange for the thread to execute serially rather than
concurrently?  Does the mere existence of threads (the way you implemented
them) cause slowness, or they only slow when used concurrently?

Xho

-- 
-------------------- http://NewsReader.Com/ --------------------
The costs of publication of this article were defrayed in part by the
payment of page charges. This article must therefore be hereby marked
advertisement in accordance with 18 U.S.C. Section 1734 solely to indicate
this fact.

Reply via email to