Re: Threading ESQL - please help me
Posted in 1998
Silviamt wrote: > > I am currently getting involved with ESQL and Threads with Informix 7.2 > I am trying to create an application that may receive many simultaneous > queries. For efficiency I want to create a connection per thread with > 20 threads to perform upto 20 concurrent queries. Thus I do not want to > ever delete either the thread or the associated connection. The examples > in the book dont really address this issue. I want to ensure that I have the > highest possible throughput when 20 queries come at the same time. > > Can each query have its own active connection? Yes, actually each thread can have as many active connections as it wants. The only restriction is that only a single thread can access a particular connection at any one time. However, when a thread is finished with a connection it can detach from the connection making the connection inactive but alive. Then any thread can attach to the connection, reactivating it, and continue where the prior thread left off. If the connection is open "WITH CONCURRENT TRANSACTION" the thread can even detach from the connection during a transaction and return to the connection later, with no loss of work, to continue the transaction, commit or roll back. > If the first query takes a long time joins etc. > and subsequent queries are simple selects do they need to wait for > the first query to relinquish the connection or is there a better way? > Note: the query is being passed as a string to my application I have no way > of knowing at runtime its complexity or what queries may immediately follow. > > If some one could give some pointers or their experiences or examples.