3

So right now I have a single thread to handle all the requests for the database. Let's say I have 400 requests per second for logins / logouts / other stuff, and 400 requests per second which are only related to items (move them, update them, remove them, etc).

Obviously, the problem is that If I want to load an item from the database, but the database is currently processing a login request, then there's gonna be a delay. And I want it to be instant, that's why I wanted to create another thread, exclusive to process item requests, and the other thread to process logins/logouts, etc.

Microsoft says this:

1: Have multiple statement handles on a single connection handle, with a single thread for each statement handle.

2: Have multiple connection handles, with a single statement handle and single thread for each connection handle.

  • What are exactly the differences on both approaches? I obviously need to fetch data and insert/update in both threads at the same time.

  • Will this 2 threads vs 1 approach speed up things?

Both threads will work exclusive in different SQL tables (ie the thread for the items will only use ITEMS_TABLE, it will never use the LOGIN_TABLE and vice-versa)

Currently I'm using the following functions (C++):

SQLSetEnvAttr with SQL_OV_ODBC3
SQLConnect

SQLAllocHandle
SQLBindParameter
SQLExecDirect

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.