| Parameter: |
ReadAhead |
| Purpose |
This is the number of rows to retrieve from the ADO or DAO
RecordSet. Set to 0 to disable ReadAhead.
ReadAhead is a parameter of the AddRS_ADO
and AddRS_DAO
methods.
|
| Example |
myXLS_obj.AddRS_ADO Rs1, 50 'Read 50 rows a time
or
myXLS_obj.AddRS_DAO Rs1, 0 ' Disable ReadAhead
|
| Description |
Using ReadAhead can result in dramatic speed savings, especially on slower
computers or computers with slow or network database connections.
example: If ReadAhead = 100 and there are 830 rows in the RecordSet
then the RecordSet will be queried 9 times. Each time 100 rows will be
read into memory.
|
| Notes |
- Set to 0 to disable. In many cases this will still be slower
than a value of 1.
- ReadAheads uses GetRows. The ReadAhead property performs its
magic by calling the GetRows method of the ADO or DAO
RecordSet. Therefore you never need to worry about implementing a call
to GetRows yourself. In fact, you will never be able to achieve
the memory conservation that SpeedGen
gets because when it uses ReadAhead it uses only the Fields required
for the current row on the spreadsheet.
- Experiment for Best Performance. If you have a large number
of Rows or Fields then you should really experiment with this value.
Try small, medium and large values (0, 10, 50, 100) to see what works
best.
- If ReadAhead is larger than the number of rows in the RecordSet,
then all Rows will be read into memory.
ADO Notes
- Only Required Fields are Loaded. Only the fields that are used
in the Excel rows currently being written are loaded into memory. So
you don't have to worry about binary or other fields accidentally being
loaded into memory.
DAO Notes
- All fields in the row are read into memory. This is a DAO
limitation. ADO does not have this limitation. If you have binary
data in one of the fields, but are not writing that field to the Spreadsheet
then you should either replace your RecordSet with a Query of only the
fields you need or disable ReadAhead ( ReadAhead = 0 ).
|
Microsoft® Excel is a Registered Trademark of Microsoft Corporation.