How to avoid parallel select-statements in the same sesssion

joergschaberjoergschaber Vertica Customer
edited July 2021 in General Discussion

Hi,

sometimes , we encounter Vertica errors when executing parallel select-queries in the same session. Parallel queries occur, because we use async methods in our C# application using the ADONET64 vertica driver.
Do you have a hint how to best avoid such parallel queries in the same session? Or do we have another problem here?
We use vertica and driver version is v10.0.1-6.
best,
Jörg

Comments

  • marcothesanemarcothesane - Select Field - Administrator

    Vertica, at least as of now, is built so that you can only have one query running per session. Each connection handle can prepare, describe and execute exactly one statement handle. I also write client programs (in good old ANSI C in my case) - but, if I need several queries, nested or in parallel, to perform a task, each thread controlling a query acquires its own connection to Vertica. It always served my purpose ...

  • joergschaberjoergschaber Vertica Customer

    We solved the problem by using a mutex, like this:

                 _mutex = new Mutex();
                _command.CommandText = "SELECT * FROM " + table;
                _mutex.WaitOne();
                VerticaDataReader reader = _command.ExecuteReader();
                reader.Close();
                _mutex.ReleaseMutex(); 
    
  • Jim_KnicelyJim_Knicely - Select Field - Administrator

    @joergschaber - Thanks for the update!

Leave a Comment

BoldItalicStrikethroughOrdered listUnordered list
Emoji
Image
Align leftAlign centerAlign rightToggle HTML viewToggle full pageToggle lights
Drop image/file