rjcpereira
rjcpereira

Reputation: 953

ListView and sqlite resultset search/filter (performance and best practices)

I've an application with a ListView to show all the available documents, this question it's about it's performance and best practices when I set the data to the ListView and when I filter the results of it.

1) There are about 60000 results in the database table, should I load all the 60000 rows once, or load 100 rows and every time that I reach the end of the ListView, execute another query and add 100 more rows?

2) I've an TextField that set the SearchText value to the ListView, but, if I'm showing just 100 or 200 rows, and the searched row it's not among them, the pretended result will never appear, should I execute an sqlite query whit the SearchText value to filter the resultset and replace the ListView data or have the 60000 rows and use the SearchText value?

Upvotes: 0

Views: 71

Answers (1)

Rene Pot
Rene Pot

Reputation: 24815

How many people will read all 60.000 rows? Exactly, none. How many people will read 100? A few, maybe.

So loading just 100 items is great for 99% of the cases. Using a widget for loading more data is basically what you need.

About searching, go with SQL query instead. Searching within 60.000 rows is quite heavy. SQL is build for it, use it to your advantage.

Upvotes: 2

Related Questions