1

I have an "select * 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?

3
  • Do you really have to select that many rows? If so, can you not split the select in multiple smaller selects?
    – vc 74
    Oct 4, 2010 at 12:26
  • Yes, you might try to make paged query instead
    – Larry
    Oct 4, 2010 at 12:30
  • Do you mean 1.5GB on the database, or the place where the C# is running? What are you doing with the rows when you get them?
    – Jon Hanna
    Oct 4, 2010 at 13:11

2 Answers 2

1

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:)

0

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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.