问题
I'm working on a C++ application with Oracle as database and trying to fetch thousands of records with CLOB datatype.
Been searching the net on how to prefetch a CLOB datatype in OCCI but always see this "Prefetching is not in effect if LONG, LOB or Opaque Type columns (such as XMLType) are part of the query."
Is there a way in OCCI in order to prefetch CLOB or are there other alternative solutions to improve the time spent to fetch CLOB data? Thanks for the help.
回答1:
There is a way to do this and we use it heavily to optimize loading tables with CLOB columns across the WAN
Instead of fetching the data as a CLOB column, convert it into a varray(16)
of varchar(32767)
select clob_to_str_array(clob_column) from table_name;
OCCI will return you a vector < std::string >
in this case. We brought down load times from 15 minutes to less than 10 seconds with this approach
I consider this one of my best optimizations ever, but I did this only because it was too late to avoid CLOB
来源:https://stackoverflow.com/questions/54784447/is-there-a-way-to-prefetch-lobs-data-in-occi