Allocate buffer dynamically for DB query according to the record actual size

戏子无情 提交于 2019-12-11 09:45:36

问题


I am using a Perl 5.8.3 script to query Oracle 11g database. The connection is established with ODBC Extension for Win32:

http://search.cpan.org/~gsar/libwin32-0.191/ODBC/ODBC.pm

As you can see in the documentation (link), the buffer size is limited to 10K. This size of the buffer is not sufficient in some cases (i.e. too small).

  1. Excerpt from the link above: “The amount of memory that is allocated to retrieve the field data of a record is dynamic and changes when it need to be larger.” I have tested it and the buffer size is not increasing with larger data. It just errors out. Is there any configuration / setup / initialization / parameters passing I need to do? Am I missing something here?
  2. What is the life span of the allocated buffer? Is it throughout the lifetime of the opened connection?
  3. I can increase the buffer size with SetMaxBuffer size up to 2GB. But to what size? Having it too large might put the server stability at risk. One option is to get the row length (the size in bytes for the actual data for all the columns for a record. Not an average) in order for us to allocate sufficient buffer size dynamically. Is there an easy way to do that or I must tally up the sum of all columns? This option will increase the DB trips but in this specific case, it’s not an issue. Related: Oracle - How do I get the actual size of a specific ROW? http://www.dba-oracle.com/t_get_length_of_row.htm

Thanks in advance!

来源:https://stackoverflow.com/questions/26005382/allocate-buffer-dynamically-for-db-query-according-to-the-record-actual-size

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!