DataSet 대신 DataReader를 사용하라....
DB에 에서 데이타를 가져온다면... DataSet이나 DataReader를 사용해 봤을 것이다.(DataTable은 DataSet과 동일하다.)
이때... 기본적으로 DataReader가 DataSet보단 성능상 잇점이 많다고 한다. 하지만 개발을 하다 보면.. DataSet이나 DataTable이 필요할 때가 있다. 그리고 사용하기도 편하다.
아무튼.. 이런 경우 어느때 이 둘을 나눠서 사용 해야 할지 고민해 볼 필요가 있다.
그래서.. 이런 글을 준비했다.^^;
아래 내용은 인터넷 어디선가... 퍼온 글이다... 출처를 모르겠다.
Use DataReader objects instead of DataSet when ever you need to display data. DataReader is the most efficient means of data retrieval!! as they are read and forward only. DataSet are disconnected and in-memory therefore uses valuable server resources. Only use them when you need the same data more then once or want to do some processing on the data.
Last but certainly not the least follow the best coding, design and deployment patterns and practices. Here are few more usefull links that can be very helpful in performance optimization of you ASP.NET application
http://msdn.microsoft.com/en-us/library/ms973838.aspx
http://msdn.microsoft.com/en-us/library/ms998569.aspx
http://msdn.microsoft.com/en-us/magazine/cc500561.aspx
http://msdn.microsoft.com/en-us/library/ms998549.aspx
http://msdn.microsoft.com/en-us/library/ms973839.aspx
번역을 위해 준비한 글이 아니기 때문에 간략이 직역을 해보자면
데이타를 화면에 출력할 필요가 있을 경우 DataSet대신 DataReader객체를 사용하란다. DataReader가 데이타를 읽고 수신하는데 훨씬 효과적이란다. DataSet은 비연결 방식으로 데이타를 서버 메모리에 저장하기 때문에 서버 자원을 사용하기 때문에 안좋단다. 아무튼 이런 이유로 DataSet은 같은 데이타를 한번 이상 사용하거나 데이타 가공이 필요한 경우에 사용하란다.
물론 가장 확실한 방법은 코딩과, 설계, 패턴 등에 따르라고 하는데... (ㅡ.ㅡ; 왠지 낚인기분인데...) 아무튼 링크된 곳을 참고하기 바란다.