I agree - for very large recordsets I suspect that time is spent allocating
memory. However I don't think it's practical (or normal) to dump 20,000
records to a webpage :-)
For a webpage that has a lot of reports, you can do something like this:
' Open connection
' Open RS and GetRows (first resultset)
' Open RS and GetRows (second resultset)
' Open RS and GetRows (third resultset)
' Close Connection
'
' Lots of other stuff here
'
'
' Write out first resultset
' Write out second resultset
' Write out third resultset
That way, your connection is only open for a small part of the webpage,
which means (usually) that you can support more clients.
Cheers
Ken
"Shailesh Humbad" <hu******@hotma il.com> wrote in message
news:Jz******** **************@ twister.columbu s.rr.com...
: I just found that GetString can be slower than looping through the
: recordset. I modified my example simpletable5.as p to check.
:
: This is the code snippet with GetString:
:
: Response.write objRS.GetString (, , vbTab, vbCrLf, " ")
:
: For 20,000 records, the server time was about 2.13 seconds.
:
: This is the current simpletable5.as p algorithm, which produces
: the same output with looping through the Recordset:
:
: Do While Not objRS.EOF
: Response.write objField0
: Response.write vbTab
: Response.write objField1
: Response.write vbTab
: Response.write objField2
: Response.write vbTab
: Response.write objField3
: Response.write vbTab
: Response.write vbCrLf
: objRS.MoveNext
: Loop
:
: For 20,000 records, the server time was about 1.25 seconds.
:
: This is rather surprising to me! I think it is because GetString needs
: to do memory allocation to create the output string, whereas
: Response.write just dumps out the data as soon as it is generated.
:
: Shailesh
:
: Ken Schaefer wrote:
:
: > a) Use GetRows/GetString rather than looping through recordsets
: >
: > b) In the "complex table" scenario, do a JOIN to retrieve all the data
as a
: > single resultset. Combine with .GetRows.
: >
: > It's not just about speed - you need to look at scalability as well.
: > Eliminating the need to mulitple recordset objects, and reducing the
amount
: > of time required for connections etc to be held open increases
scalability
: > in terms of the number of users your webapp can support.
: >
: > Cheers
: > Ken
: >
: > "Shailesh Humbad" <hu******@hotma il.com> wrote in message
: > news:IQ******** **************@ twister.columbu s.rr.com...
: > : I just posted an article I wrote called ASP Speed Tricks. It covers
: > : techniques to optimize output of database data in HTML, for
: > : both simple tables and complex tables. More advanced ASP authors
might
: > : be interested in the complex table optimizations. Please check it out
at:
: > :
: > :
http://www.somacon.com/aspdocs/
: > :
: > : Hope you enjoy,
: > : Shailesh
: > :
: > : Please reply at
http://www.somacon.com/contact.php
: > :
: >
: >
: