Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8267609
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T05:35:45+00:00 2026-06-08T05:35:45+00:00

I need to assign value to FetchSize. rowsize can be received from datareader using

  • 0

I need to assign value to FetchSize. rowsize can be received from datareader using refelection.

But I need row count, can I harcode as rowsize * 100000 (instead of rowcount).

executedataReader will be used for multiple stored procedures, cant get rowcount.

            OracleDataReader dr = command.ExecuteReader();

            Int32 rowCount = 100000; //in this case actual result will be just 20k only. will it have any issue?

            FieldInfo fi = dr.GetType().GetField("m_rowSize", BindingFlags.Instance | BindingFlags.NonPublic);

            Int32 rowSize = Convert.ToInt32(fi.GetValue(dr));

            dr.FetchSize = rowCount * rowSize;

            while (dr.Read())
            {
                string myField = (string)dr[0];
                Console.WriteLine(myField);
            }

will there be any cons by fixing this?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-08T05:35:46+00:00Added an answer on June 8, 2026 at 5:35 am

    The FetchSize property here limits the amount of memory that is allocated for a single “fetch” back to the database. Smaller fetch sizes mean more round trips to get data, but also means less memory in use on the client at any given time.

    Setting the fetch size to something like RowSize * n will tell the reader to always fetch at most n rows at one time. If you set n equal to RowCount you are saying “fetch the entire result set at once”. If you set n equal to a fixed number, you are saying “fetch me 1000 (or 10000 or 25000 or whatever) rows at once”. When you call DataReader.Read(), the data reader will try to return rows that it has already fetched and cached. If you asked it to fetch 100,000 rows at a time, it will only need to talk to Oracle once every 100,000 Read() calls.

    A higher fetch size will mean more efficient network traffic, fewer trips to the database, and thus will generally be “faster” under most circumstances. However, it will mean comparatively more memory used on the client, so if the fetch size gets really big you can run into garbage collection and/or paging issues. That’s up to you.

    Note that it’s perfectly legal to assign FetchSize a value that’s not a multiple of the row size, it will just result in some leftover memory being unused on each fetch. If you’re using the same Command object for multiple stored procedures with different row sizes, you may be better off just setting a large FetchSize value — in actual bytes — up front and using that for everything.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am using SMARTY and I need to create an array and assign value
I need to get UserCarId(int) from this query and assign to int type variable.
I need to find the text 'ifeq ($(Param1)' using grep. I try to assign
I often need to assign a variable, if the source value is set. So
I need to assign values from a small dictionary collection (10 items) to a
I need to assign constant value in integer (or other data type). I got
I recently discovered that you can conditionally assign a value with an if-else block.
Im extending a class (DirectoryServices.AccountManagement.Principal) and I need to assign a value to a
I am using the below way to assign value to a variable. <xsl:variable name=NewValue>
I need to create a variable and assign a value to this variable to

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.