Re: DataTable efficiency

Shawn Wildermuth <[email protected]> Wed, 21 Nov 2007 13:52:07 -0500
Newsgroups gmane.comp.windows.devel.dotnet.cx
Message-ID <[email protected]>
The efficiency of the DataTable class is dependent on the features you are
using.  This doesn't mean it uses lots of memory if you use lots of
features, but instead...if you need the ability to track changes and do
complex searching in a DataTable (especially in related DataTables), then
the DataTable is pretty efficient as it is compared with a custom set of
code that does the same thing.  But if you just need data storage the
DataTable is not as efficient...custom data classes would be just as easy.
There is a good CSV reader/writer class (I think it's on CodePlex) if you go
that route.

Thanks,

Shawn Wildermuth
http://adoguy.com
http://wildermuthconsulting.com
Microsoft MVP (C#), MCSD.NET, Author and Speaker

The Silverlight Tour is coming to a city near you!


-----Original Message-----
From: Discussion relating to the specifics of the C# and Managed C++
languages [mailto:[email protected]] On Behalf Of Alan Baljeu
Sent: Wednesday, November 21, 2007 9:31 AM
To: [email protected]
Subject: [DOTNET-CX] DataTable efficiency

My application uses a largish readonly database (CSV files, actually)
consisting of several
tables.  These tables are accessed somewhat frequently, and I want to make
this as efficient
as possible.  I'm currently using plain DataTable objects produced by
OdbcAdapters and
queries.     These tables are cached so I'm just searching in-memory tables
after that.  My
queries look like "SELECT * FROM [{0}]" and occasionally "SELECT * FROM
[{0}] where [{1}] =
'{2}'".    I'm thinking of splitting the latter into just
table.Select("colname = value").

I have a nagging suspicion that the DataTable structure isn't
super-efficient, or that
certain ways of using it are effcient while others aren't.

Is this so?  Are there certain things I should avoid?  Do you recommend a
certain style for
efficient access?  Is there a better approach that DataTable?

===================================
This list is hosted by DevelopMentor.  http://www.develop.com

View archives and manage your subscription(s) at http://discuss.develop.com

===================================
This list is hosted by DevelopMentorĀ®  http://www.develop.com

View archives and manage your subscription(s) at http://discuss.develop.com