I think it applies because the whole discussion was about what's a 'faster' way 
to do this...

My point is that the second query is getting the data to display on the page in 
question (say records 51 - 100), so why does the first query need to return all 
rows of the data?  If the first query is purely to get a count (so you know 
what to divide by to split up your pages) then it seems to me to be unnecessary 
to return the additional data that won't even be accessed.  The second query 
(of the 2 query approach) gets the actual data to display and (in this 
scenario) would only contain 50 records.  

The example I gave would of course need to have a WHERE clause limiting to 
whatever the particular criteria is for this page display...it wasn't just to 
get an arbitrary count of all the records IN ADDITION to the 2 queries in your 
approach.

The whole point was to say that using Count(ID) is faster than using Count(*) 
or SELECT ID (getting all rows).

Dave

-----Original Message-----
From: S. Isaac Dealey [mailto:[EMAIL PROTECTED]
Sent: Wednesday, August 31, 2005 2:33 PM
To: CF-Talk
Subject: RE: Paging through records


Well I think the count() example is sort of outside of the scope of
what was being described... The specific question (as I understood it)
was whether a pair of queries could be faster for presenting a sub-set
of records in a list page -- the count() query isn't part of the task
of fetching and presenting those records, so it's sort of moot. And in
that scenario, if you use the 2-query approach, you can use
query1.recordcount to get the total number of records (and divide that
to get the number of pages), so that eliminates the need to perform a
separate count() query if you want to display total # of available
records on the page.

> I agree with Isaac.  The first query could even be:

> <cfquery name="TotalCount">
>       select count(id) as TheCount
> </cfquery>


s. isaac dealey   954.522.6080
new epoch : isn't it time for a change?

add features without fixtures with
the onTap open source framework

http://www.fusiontap.com
http://coldfusion.sys-con.com/author/4806Dealey.htm






~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Discover CFTicket - The leading ColdFusion Help Desk and Trouble 
Ticket application

http://www.houseoffusion.com/banners/view.cfm?bannerid=48

Message: http://www.houseoffusion.com/lists.cfm/link=i:4:217033
Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4
Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
Donations & Support: http://www.houseoffusion.com/tiny.cfm/54

Reply via email to