On Tuesday, October 7, 2014 4:00:56 PM UTC+2, Narūnas Krasauskas wrote:
>
> Hi,
>
> Thanks for the reply.
>
> I just tested my notorious 38 sec query directly on the MySQL, and it also 
> took nearly 40 sec to complete, so after all it was not web2py's fault :-)
>
> Further I also tested *cache_count* option, and indeed like you said, it 
> does something very similar to what I need, thank you for hint!
> However there are few flaws and very unexpected behaviour:
> 1) Giving *cache_count* and *paginate* same values (eg. *cache_count=20*
>  and *paginate=20*) will yield ALL rows at once, without pagination.
>

strange bug. If reproduces, needs fixing.
 

> 2) If a returned dataset is smaller than a *cache_count* - it will show 
> empty pagination breadcrumbs (eg. *cache_count=10;* *paginate=4; 
> dataset=3 - it will show 3 rows on the first page, but still add pages 2 
> and 3 in the breadcrumbs, even tho they are empty... Clicking on them 
> simply yields '*No records found'*)*
>

I won't expect any less. Without giving the possibility to web2py to count 
records, there's no other way around it
 

> 3) If cache_count is not a multiple of a paginate, user will be presented 
> with cache_count + difference records (eg. *cache_count=10;* *paginate=4; 
> will present 12 rows for the user)*
>

Again, cache_count DOES NOT LIMIT the rows. At most, it limits the 
generate(able) pages. Your initial request was requesting exactly this
 

> 4) If all goes well and I close my eyes to the fact that user will 
> retrieve slightly more records than I defined in *cache_count*, there 
> still is a problem. If user would click on the table headers to change sort 
> order - he would see *cache_count *number of records from the end of full 
> dataset. (eg. *cache_count=10;* *paginate=4; returned **dataset=52; in 
> this case user will be able to see first **12 rows, then reorder and see 
> last 12 rows in the dataset, that is 24 rows in total instead of initially 
> desired 10...)*
>

Doesn't change what web2py can do. Even if we cut the number of rows 
displayed exactly as you wish (i.e. 13), they won't be the same if user 
changes ordering. If you want a fixed set of records that the user needs to 
see, you need to pass a query to the grid (i.e. 
db.table.id.belongs((1,2,3,4,5,6,7))). But this clearly defies what you 
started the question with, that was "my users can see 1+m records anyway"


-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to