|
 |
asp_databases thread: RecordSet size
Message #1 by "Jon Shoreman" <Jon.Shoreman@b...> on Tue, 9 Oct 2001 18:08:46
|
|
Is it possible to get the size of a RecordSet WITHOUT moving through all
the records?
Message #2 by "Monique Angelich" <mangelich@m...> on Tue, 9 Oct 2001 13:26:40 -0400
|
|
how about "select count(*) as newCount from Table Where this=that AND
that=This"
response.write(rs.fields("newcount")
Moe
----- Original Message -----
From: "Jon Shoreman" <Jon.Shoreman@b...>
To: "ASP Databases" <asp_databases@p...>
Sent: Tuesday, October 09, 2001 6:08 PM
Subject: [asp_databases] RecordSet size
> Is it possible to get the size of a RecordSet WITHOUT moving through all
> the records?
Message #3 by "Tomm Matthis" <matthis@b...> on Tue, 9 Oct 2001 13:52:45 -0400
|
|
Yes, if the database supports it, and the type of recordset and "location"
(adUseClient), you are using.
-- Tomm
> -----Original Message-----
> From: Jon Shoreman [mailto:Jon.Shoreman@b...]
> Sent: Tuesday, October 09, 2001 6:09 PM
> To: ASP Databases
> Subject: [asp_databases] RecordSet size
>
>
> Is it possible to get the size of a RecordSet WITHOUT moving through all
> the records?
Message #4 by "Ken Schaefer" <ken@a...> on Wed, 10 Oct 2001 16:43:05 +1000
|
|
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
From: "Jon Shoreman" <Jon.Shoreman@b...>
Subject: [asp_databases] RecordSet size
: Is it possible to get the size of a RecordSet WITHOUT moving
: through all the records?
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
http://www.adopenstatic.com/faq/recordcounterror.asp
(why .RecordCount is returning -1)
http://www.adopenstatic.com/faq/recordcountalternatives.asp
(better alternatives to .RecordCount which do the same thing)
Cheers
Ken
Message #5 by "Jon Shoreman" <Jon.Shoreman@b...> on Thu, 11 Oct 2001 00:10:22
|
|
> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> From: "Jon Shoreman" <Jon.Shoreman@b...>
> Subject: [asp_databases] RecordSet size
>
>
> : Is it possible to get the size of a RecordSet WITHOUT moving
> : through all the records?
> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>
> http://www.adopenstatic.com/faq/recordcounterror.asp
> (why .RecordCount is returning -1)
>
> http://www.adopenstatic.com/faq/recordcountalternatives.asp
> (better alternatives to .RecordCount which do the same thing)
>
> Cheers
> Ken
>
Great links Ken, thanks.
I should have said I am using an Access database.
Message #6 by "Jon Shoreman" <Jon.Shoreman@b...> on Thu, 11 Oct 2001 09:26:53
|
|
> "select count(*) as newCount from Table Where this=that AND
> that=This"
This of course will work, however it would require two hits on the
database. One to get the RecordSet, and another to get the count. Not very
efficient, especially when the RecordSet in question could contain a few
thousand records.
Thanks for the suggestion anyway.
Message #7 by "Ken Schaefer" <ken@a...> on Fri, 12 Oct 2001 12:14:34 +1000
|
|
I've never seen a practical use for returning thousands of records to a
webpage...
That said, if you use .getRows and UBound() to get both the data and the
recordcount, and you have thousands of records, you need to use .getChunk to
make it go "really fast" (highly technical term)
(but it does lead to messier code...)
Cheers
Ken
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
From: "Jon Shoreman" <Jon.Shoreman@b...>
Subject: [asp_databases] Re: RecordSet size
: > "select count(*) as newCount from Table Where this=that AND
: > that=This"
:
: This of course will work, however it would require two hits on the
: database. One to get the RecordSet, and another to get the count. Not very
: efficient, especially when the RecordSet in question could contain a few
: thousand records.
:
: Thanks for the suggestion anyway.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Message #8 by "Dallas Martin" <dmartin@z...> on Thu, 11 Oct 2001 22:41:33 -0400
|
|
Don't forget that GetRows() and GetString() use lots of MEMORY.
So momentarily, you'll have a hugh recordset and a hugh array
in memory. For every user that hits the page which returns 1,000's of
records
you'll use up lots of memory. I wouldn't be surprised if your server
didn't crash.
Moreover, Would any user really page through 1,000's of records???
I wouldn't. If a page takes long to load, I'm gone in a hurry. The site
sucks!!!
Dallas
----- Original Message -----
From: "Ken Schaefer" <ken@a...>
To: "ASP Databases" <asp_databases@p...>
Sent: Thursday, October 11, 2001 10:14 PM
Subject: [asp_databases] Re: RecordSet size
> I've never seen a practical use for returning thousands of records to a
> webpage...
>
> That said, if you use .getRows and UBound() to get both the data and the
> recordcount, and you have thousands of records, you need to use .getChunk
to
> make it go "really fast" (highly technical term)
> (but it does lead to messier code...)
>
> Cheers
> Ken
>
> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> From: "Jon Shoreman" <Jon.Shoreman@b...>
> Subject: [asp_databases] Re: RecordSet size
>
>
> : > "select count(*) as newCount from Table Where this=that AND
> : > that=This"
> :
> : This of course will work, however it would require two hits on the
> : database. One to get the RecordSet, and another to get the count. Not
very
> : efficient, especially when the RecordSet in question could contain a few
> : thousand records.
> :
> : Thanks for the suggestion anyway.
>
>
Message #9 by "Ken Schaefer" <ken@a...> on Fri, 12 Oct 2001 18:02:09 +1000
|
|
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
From: "Dallas Martin" <dmartin@z...>
Subject: [asp_databases] Re: RecordSet size
: Don't forget that GetRows() and GetString() use lots of MEMORY.
: So momentarily, you'll have a hugh recordset and a hugh array
: in memory.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Hence the need to use .GetChunk, and avoid things like SELECT *
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
: For every user that hits the page which returns 1,000's of
: records you'll use up lots of memory. I wouldn't be surprised
: if your server didn't crash.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Again, .GetChunk
+
Limit the query to returning only the columns/rows required (eg SELECT TOP
100) to get records 80-100 in a 1500 record result set.
Use objRS.Move to move to record 80
Use .getRows(20) to get only 20 records into your final VBScript array
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
: Moreover, Would any user really page through 1,000's of records???
: I wouldn't. If a page takes long to load, I'm gone in a hurry. The site
: sucks!!!
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
If you're paging, there's no need to return thousands of records to the
webpage - just return the ones you want. I really can't think of any
practical example of returning thousands of records to a single webpage...
The following is not from my site, but done by someone who does know what
he's talking about:
http://24.0.107.232:81/
extremely fast .getRows
Cheers
Ken
|
|
 |