I am using dotConnect Universal Professional 3.20.54.0 to connect to a Postgres SQL server. I am opening a reader to it and logging data to a file. However, a strange thing is going on. When the "ExecuteReader()" executes, it takes a long time (in several minutes) and the memory climbs to a staggering value.
It is as if the Reader is actually acting like a DataSet, it first pulls entire data to client machine and then processes it by going to the next statement. DataReaders are supposed to be lightweight otherwise. The table in question contains 2mil records. Sample code is given below.
Code: Select all
string conn_str = "Provider=PostgreSQL; Server=192.168.1.50; Port=5432; Database=company; User ID=sys; Pooling=true; Connection Lifetime=86400; Connection Timeout=360;";
UniConnection ucon = new UniConnection(conn_str);
UniCommand ucmd = new UniCommand("select * from mytable", ucon);
UniDataReader ured = null;
ucon.Open();
ured = ucmd.ExecuteReader(); // this line eats time+mem
int i = 0;
while (ured.Read())
{
i++;
System.Diagnostics.Debug.WriteLine(string.Format("{0} --> {1}", i, ured[0]));
// Code to write data to a log file
}
ured.Close();
ucon.Close();
I am new to Devart. Is this behavior expected?