A reader, March 23, 2007 - 2:32 pm UTC
How to be really sure the resultset will fit into the PGA?
If I know the number of rows, and from the query the size of the column, could you demonstrate with a simple example (say a bulk load from T, perhaps) how to check we won't hit Ora-4030?
Thanks
March 26, 2007 - 7:08 am UTC
you need no example, it is just a simple memory measurement here. If you have N rows and width is M, it'll be at least N*M in size - only bigger because it is a data structure in PLSQL (they have their bits and bytes they'll add).
Just be reasonable and use between 100 and 500 rows at a time. You do not want an entire result set in memory, you want a slice of it, work on it, get rid of it, get next slice of it.
alternative method
Connor, April 05, 2007 - 1:59 am UTC
or bulk collect into a varray. at least that way, when you grow to above what you were expecting, you'll get an error, not exhaust of all your memory