I'm building my own record counter and paginator for index functions, like this:
'records 1 - 20 of 315 found by query' The question is what is the best way to get the total record count, in this case 315. In the case above, I use a limitby(0, 20) to get the first 20 records. I can think of two ways to do it, but I don't like either one. First is to formulate the query without the limitby clause and do a db(query).count(). That would give me the total number of records in the set. Then add the limitby clause to the query to get the records of interest. I don't like this because it involves two hits to the database. The second way is to get the entire record set by running a select without the limitby, then letting Python take the desired slice out of the row set. I don't like this method because it might return a lot of rows. Thus I get the db bottleneck again plus the overhead of turning all of the rows into Web2py objects. There must be a better solution. Can some kind soul tell me what it might be? All opinions welcome. Thanks, Cliff Kachinske