dbhub.io icon indicating copy to clipboard operation
dbhub.io copied to clipboard

Add a filter row to the Data tab, like we have in DB4S

Open justinclift opened this issue 9 years ago • 4 comments

As suggested by @innermous, it would be useful to have a filter row in the data tab (as per DB4S).

This would let people easily select a subset of rows to view.

justinclift avatar Jan 20 '17 00:01 justinclift

This should be possible with the new React based "react-data-grid" component we're using.

It already has "filter" functionality built into it, we'd just need to do some plumbing so the filter terms get turned into appropriate SQL queries, preferably using the same rules as in DB4S.

@MKleusberg is likely to be the person who looks into this. :smile:

justinclift avatar Apr 24 '23 17:04 justinclift

Yes, should be fairly straightforward. The main issue here is probably the performance impact, especially for large databases without proper indexes. Of course we could just implement it anyway or we might want to find some way to queue SQL statements (also for standard databases) and send the filter statements with low priority. Or we could limit filtering to indexed columns.

MKleusberg avatar May 05 '23 20:05 MKleusberg

Hmmm, it's probably better to add an index when it's missing, so that way it then "just works" for that column from then on. And yep, even though it takes up a bunch of extra disk space.

That's already the approach we use when sorting on a column anyway, so it's just running with that... :smile:

https://github.com/sqlitebrowser/dbhub.io/blob/81a2b41dc957f490927520bf081f0dbe4aa56fbd/common/sqlite.go#L859-L878

In practise, the index creation goes very quickly. It's sub-second for most databases, as they're pretty small. The larger sized databases (eg ~1GB+) seem to only take a few seconds too, so I think we'll be fine. Hopefully. :wink:

justinclift avatar May 05 '23 20:05 justinclift

@captn3m0 You might want to keep an eye on this issue. :smile:

justinclift avatar May 05 '23 21:05 justinclift