FetchSize

This property specifies the total memory size, in bytes, that the provider allocates to cache data fetched in one database round-trip, used by OracleDataReader's internal cache to store result set data.

Declaration

// C#
public long FetchSize { get; set;}

Property Type

System.Int64 (long)

Exceptions

InvalidArgument - The specified value is less than 0 or greater than System.Int64.MaxValue .

System.ObjectDisposedException - This property cannot be accessed after the OracleConnection object is already disposed.

Remarks

The default value is 131072.

The FetchSize property can be configured on OracleDataReader , OracleCommand , OracleConnection , and OracleConfiguration objects. By default, OracleConnection FetchSize property value inherits OracleConfiguration FetchSize property value at construction time; OracleCommand FetchSize property value inherits OracleConnection FetchSize property value at construction time; OracleDataReader FetchSize property value inherits OracleCommand FetchSize property value at a command execution. The value of OracleDataReader FetchSize determines the amount of data the OracleDataReader fetches into its internal cache for each database round-trip.

If the OracleCommand XmlCommandType property is set to any value other than None, this property is ignored.

The OracleCommand RowSize and OracleCommand FetchSize properties handle UDT and XMLType data differently than other scalar data types. Because only a reference to the UDT and XMLType data is stored in the ODP.NET's internal cache, the OracleCommand RowSize property accounts for only the memory needed for the reference (which is very small) and not the actual size of the UDT and XMLType data. Thus, applications can inadvertently fetch a large number of UDT or XMLType instances from the database in a single database round-trip. This is because the actual size of UDT and XMLType data do not count against the FetchSize , and it would require numerous UDT and XMLType references to fill up the default cache size of 131072 bytes. Therefore, when fetching UDT or XMLType data, the FetchSize property must be appropriately configured to control the number of UDT and XMLType instances that are to be fetched, rather than the amount of the actual UDT and XMLType data to be fetched.

Note:

For LOB and LONG data types, only the sizes specified in the OracleCommand InitialLOBFetchSize and OracleCommand InitialLONGFetchSize properties are accounted for by the RowSize property in addition to the metadata and reference information that is maintained by the cache for each LOB in the select list.