Quantcast
Channel: MySQL Forums - Connector/NET and C#, Mono, .Net
Viewing all articles
Browse latest Browse all 1447

Query is slow - always ~200ms (1 reply)

$
0
0
Hi !

I try to read some data from my database (5.5). And I used two variants:
DataReader and DataSet.

This is the code I used:
DataReader:
conn = new MySqlConnection(cs);
conn.Open();
string stm = "SELECT * FROM data1 ORDER BY ID DESC LIMIT 2";
MySqlCommand cmd = new MySqlCommand(stm, conn);
rdr = cmd.ExecuteReader();

DataSet:
string stm = "SELECT * FROM data1 ORDER BY ID DESC LIMIT 2";
conn = new MySqlConnection(cs);
conn.Open();
ds = new DataSet();
da = new MySqlDataAdapter(stm, conn);
da.Fill(ds, "data");

I measured the time for the Code parts above and I got this results:
1) DataReader
LIMIT = 2 ~ 226 ms
LIMIT = 2560 ~ 218 ms
2) DataSet

LIMIT = 2 ~ 204 ms
LIMIT = 2560 ~ 280 ms

The server is local running.

So why are there always ~200ms of time wasting?

Any help would appreciated.

Dominik

Viewing all articles
Browse latest Browse all 1447

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>