Query is slow - always ~200ms
Posted by: Dominik Schmidt
Date: October 10, 2012 07:29AM

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

Options: ReplyQuote


Subject
Written By
Posted
Query is slow - always ~200ms
October 10, 2012 07:29AM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.