WaitAll Problem

Discussion of open issues, suggestions and bugs regarding ADO.NET provider for universal data access
Post Reply
utkuunal
Posts: 1
Joined: Wed 30 Jun 2021 14:29

WaitAll Problem

Post by utkuunal » Wed 30 Jun 2021 14:32

Hello i have been trying to replicate one the examples in the documentation (https://www.devart.com/dotconnect/unive ... onous.html, Synchronization objects part) but for some reason my code never stop at the WaitAll part. I was wondering what is the reason of this problem.

As an additional information WaitAll worked with OracleDataTable (It actually waited).

Here is a part from my code. Im sending a SQL Query that should take 2 min 10 sec

Im using dotConnect Universal 3.80.2402 Standart Edition

myConnections[0] = new UniConnection(conStr);
myCommands[0] = new UniCommand("SELECT DISTINCT * FROM (SELECT T2.* FROM (SELECT * FROM ASGPT_KUTHAY where rownum <4) T1, HAB_KAYIT T2, TENAY T3)", myConnections[0]);
myConnections[1] = new UniConnection(conStr);
myCommands[1] = new UniCommand("SELECT DISTINCT * FROM (SELECT T2.* FROM (SELECT * FROM ASGPT_KUTHAY where rownum <4) T1, HAB_KAYIT T2, TENAY T3)", myConnections[1]);


myConnections[0].Open();
myConnections[1].Open();
aResults[0] = myCommands[0].BeginExecuteReader();
aResults[1] = myCommands[1].BeginExecuteReader();


Console.WriteLine("Waiting for operations to complete...");
bool alldone = WaitHandle.WaitAll(new System.Threading.WaitHandle[] {
aResults[0].AsyncWaitHandle,
aResults[1].AsyncWaitHandle });

var myReader=myCommands[0].EndExecuteReader(aResults[0]);
var myReader1=myCommands[1].EndExecuteReader(aResults[1]);

DmitryGm
Devart Team
Posts: 152
Joined: Fri 11 Dec 2020 10:27

Re: WaitAll Problem

Post by DmitryGm » Fri 02 Jul 2021 12:17

utkuunal wrote: Wed 30 Jun 2021 14:32 Im sending a SQL Query that should take 2 min 10 sec
I suppose it is the time spent to fetch all the data returned by the SELECT query. Note that even in the synchronous mode, when we perform a SELECT command against the Oracle database (via dotConnect Universal or dotConnect for Oracle), the Execute method doesn't take any time, and returns a value immediately.

Code: Select all

UniCommand cmd = conn.CreateCommand();
cmd.CommandText = "SELECT * FROM VERY_BIG_TABLE";
UniDataReader reader =  cmd.ExecuteReader(); // Will be execute immediately
  
while (reader.Read()) { /* … */ } // The time will be spent here
The time will be spent reading data.


The Execute method can take much for non-Select queries only. For example:

Code: Select all

UniCommand cmd = conn.CreateCommand();
cmd.CommandText = "UPDATE BOOKS SET TAG = SLOW_FUNCTION(1)";
cmd.ExecuteNonQuery(); // Will take much time
Therefore, the asynchronous ExecuteReader methods don't take much time. It's fetching data via that reader that may take much time.

Griffin
Posts: 1
Joined: Tue 27 Sep 2022 10:16

Re: WaitAll Problem

Post by Griffin » Tue 27 Sep 2022 10:21

In both cases, dotConnect Universal is a lot slower than the "native" providers for .NET. GB Whatsapp

DmitryGm
Devart Team
Posts: 152
Joined: Fri 11 Dec 2020 10:27

Re: WaitAll Problem

Post by DmitryGm » Tue 04 Oct 2022 18:46

Griffin wrote: Tue 27 Sep 2022 10:21 In both cases, dotConnect Universal is a lot slower than the "native" providers for .NET.
The main feature of dotConnect Universal is access to multiple database servers using the same code, but dotConnect Universal doesn't support database-specific features for all databases.
So, with database specific providers you can reach better performance than dotConnect Universal.

Post Reply