开发者

reduce db reader memory usage

开发者 https://www.devze.com 2023-01-18 11:56 出处:网络
I have an "select 开发者_StackOverflow社区* from tables..joins..." query on an oracle database, which would return about 22 milion rows. I\'m using C# and ODP.NET, like so:

I have an "select 开发者_StackOverflow社区* from tables..joins..." query on an oracle database, which would return about 22 milion rows. I'm using C# and ODP.NET, like so:

oracleDataReader odr = command.ExecuteReader();

But during execution of this statement, the process takes about 1,5 Gb RAM, which is not very good.

Any idea on how to save some memory?


First off all try to add some where clauses in the query if it's possibl to minimize the amount of results. Are you sure you need all 22milions results at once?

then you can change select * from.... into select columnA, columnB from... that would also save some memory, since select *... returns data from all the columns, all tables you used in that query. That might be not effiecient. greetings:)


Oracle must support such expression: SELECT * from Table WHERE ROWNUM <= 10

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号