Slow Fill method of DataAdapter class

  • Thread starter Thread starter Radovan Radic
  • Start date Start date
R

Radovan Radic

Hello

I tried to find answer on google but i didnt find it.
Using MySQL 4, with MyODBC driver
This code:

string sql = "SELECT * FROM Poruke";
OdbcDataAdapter da = new OdbcDataAdapter();
da.SelectCommand = new OdbcCommand(sql, conn);
DataSet ds = new DataSet();
da.Fill(ds,"Poruke");

takes about 2.5 minutes to run. There are ~36000 records in the table,
12 columns.It is not problem with the network, because i have tried this
on local machine as well.
Does anyone know what is the problem here?

Radovan
 
Look at the indices you've defined on the Poruke table.... perhaps it's
doing a linear search in the table and that's what's taking so long.
 
First you need to determine if the bottleneck is with the query (try running
it with a DataReader or from Access) or not. It could also be a bandwidth
issue. 36,000 is a VERY large amount of records and not well advised - you
could break this up and run them in seperate threads or just grab a subset
and use what you need caching say 6,000 at a time. There's nothing that can
be done with .Fill other than speeding up the query- remember that you are
loading all that data locally on your machine(use TaskManager and watch the
resources) and that's a good bit of data. Also, SELECT * usually pulls over
a few columns (usually, definitely not always) that you dont' need, so it's
usually not a good idea to use it unless you definintely need all of those
column's data.

--

W.G. Ryan, eMVP

Have an opinion on the effectiveness of Microsoft Embedded newsgroups?
Let Microsoft know!
https://www.windowsembeddedeval.com/community/newsgroups
 
Correct me if I'm wrong - but why would he need an index? His select statement does not have a WHERE clause. A linear search is
exactly what needs to be performed (because all values are returned) right?
 
Yep true, unless Poruke was a view rather than a table.
I was a bit hasty in that response.. sorry about that.

--
John Wood
EMail: first name, dot, second name at priorganize.com


Adam Clauss said:
Correct me if I'm wrong - but why would he need an index? His select
statement does not have a WHERE clause. A linear search is
 
Ah... true true. I have not had much experience working with views and had not considered that possibility.
 
could it possibly be a shortage of physical memory at the client,
causing it to page like crazy just to get all of the DataSet into
virtual memory?
 
Back
Top