views:

50

answers:

1

In my web application, I have a dynamic query that returns huge data to datatable, and this query is often recalled with different parameters. So database is exhausted.

I want to get all record with no parameters to an object, and perform queries (may be with linq) on this object. So database will not be exthausted.

Which objects can be used instead of datatable?

+3  A: 

This is one of my pet peeves - people who return all the data from the database.

There is absolutely no need for this unless you are doing reporting.

If you are doing reporting, then you need to increase your hardware capability so that the database can cope. This may also include tuning your database, rearranging tables, reindexing, regular rebuilding of indexes, updating statistics, archiving out old data, etc.

If you are NOT doing reporting, then start limiting how much data can be queried at any one time. Users DO NOT need to see massive quantities of data all at once. They need to see discrete amounts of data presented in a manageable and coherent way.

Another rule of thumb i like to observe is: let your database server do the work, it is made to manipulate lots of data, it is what it is good at, and it should have the power to do it. Pulling back loads of data to the client, and then trying to manipulate that data on the client is a foolish thing to do. If your client machines are more powerful than the database server then you have issues.

slugster
+1 amen, brother! :-)
marc_s