<< Click to Display Table of Contents >> Navigation: Apollo VCL Components > Apollo VCL Component Reference > TApolloTable > TApolloTable Methods > FetchCount |
Declaration
property FetchCount: Integer;
Description
This indicates how many records at a time should be fetched from the server when reading rows from the table. The default value is 50. On faster connections, this value can be set higher (100 to 1000 or more) to read larger groups of records at a time. On slower connections, you may want to reduce this number.
When FetchCount = 10, client makes one single request for 10 records and gets back 10 records. When FetchCount = 1000, the client makes one single request for 1000 and gets back 1000 records from the server.
Proper use of FetchCount can result in a huge speed increase especially when traveling in one direction. The key point here is "proper" use of FetchCount. By this we mean that you should not just set
FetchCount = 10000000 on every project. And here's why…
Unlike TApolloQuery that fetches records only once then caches them internally, TApolloTable fetches data on demand. This means if you are traveling in one direction, you should set the FetchCount at a very high number. You can then travel the table at "supersonic" speed. This is especially true for writing reports.
However, say you had a grid. In this case, the user could switch directions at any time which results in the internal MultiTraverseTable routine being called with FetchCount of records retrieved from the server. (In this case, MultiTraverseTable is called once each time you hit PageUp or PageDown.) If a grid contained 50 rows, then FetchCount should be no more than 100 or perhaps 200. Why? Because you will be fetching more than your grid could chew.
Say you set FetchCount = 1000 in this case. The user hits PageDown and fetches 1000 records. Only the first 50 are displayed on the grid. He then decides to go backward and hits PageUp. Another 1000 records must be retrieved in the opposite direction this time. Again only first 50 are displayed on the grid. You can see how this results in a waste of resources, unnecessary traffic on the network, and more importantly server being pressed for data that is not even
used.
FetchCount = 200 would be a good choice in the above case assuming someone who hits PageDown is likely to hit it again! So you have buffered the next four pages for him.
Delphi Example
ApolloTable1.FetchCount := 100;
C++Builder Example
ApolloTable1->FetchCount = 100;