currently not but it is planned to be configurable (at the very minimum, 
cacheable). 

Your method BTW works only if all the table is shown, doesn't take into 
account a possible condition passed to the grid (such as db.table.user_id 
== auth.user_id) or keyword queries.

I'll start working on that as soon as possible, shouldn't be hard.....
Talking about "extensibility", what you'd like to pass as a parameter ?
I'm thinking to allow:
 - a callable (to which query and keywords are passed) --> you can pass the 
result of your custom query in this case, just watch out for the 
shortcomings explained earlier
 - an integer (which will trigger the "cache this count" for n seconds)

Would that be enough?

On Wednesday, April 17, 2013 12:58:27 PM UTC+2, Johann Spies wrote:
>
> By large datasets I mean a database of which one of the tables contain 
> more than 42 million records.
>
> Using SQLFORM.grid on such a dataset is very slow because the process 
> wants to count the total number of records.
>
> I am using Postgresql.  I can get an estimated size of the table by 
> replacing count(*) with 
>
> # SELECT reltuples::integer FROM pg_class WHERE oid = 
> 'isi.ritem'::regclass;
>  reltuples
> -----------
>   42183232
> (1 row)
>
> And I get the result in a fraction of a second. When working on such a 
> scale the exact number of rows (count is also not always accurate on an 
> active database) is not a necessity.
>
> Is there a way I can replace the count(*) in the grid with the query 
> illustrated above?
>
> Regards
> Johann
> -- 
> Because experiencing your loyal love is better than life itself, 
> my lips will praise you.  (Psalm 63:3)
>  

-- 

--- 
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 web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to