simonw / datasette

An open source multi-tool for exploring and publishing data
https://datasette.io
Apache License 2.0
9.4k stars 671 forks source link

Filtered tables should show count of all matching rows, if fast enough #127

Closed simonw closed 6 years ago

simonw commented 6 years ago

Relates to #86. If you are viewing a filtered page e.g. https://fivethirtyeight.datasettes.com/fivethirtyeight-2628db9/bob-ross%2Felements-by-episode?CLOUDS=1 we should show the count of matching rows.

Since this could be an expensive operation, we will run it with a strict time limit (maybe 50ms). If the time limit is exceeded we will display "many" instead, perhaps? Maybe even link to a count(*) query that would get the full 1000ms time limit which the user can click on if they like (that could even Ajax-in the result).

simonw commented 6 years ago

Maybe I should support &_count=1 to handle this - that would be easy to Ajax-in in conjenction with the other filters.

simonw commented 6 years ago

I implemented a basic version of this in f59c840e7db8870afcdeba7a53bdea07bb674334 for custom SQL.