I have a large table of around 2500 entries. I am displaying it on tableview. however the search bar is too slow while doing dynamic search. ie I am filtering the table ever
SQLite's selects are usually very fast. If you posted some sample queries, it'd probably be easier to help you.
However, that said: If you have a query with a simple WHERE clause that's performing slowly, you probably don't have an index on the column that's being searched. Add one.
2500 entries in a table is NOT large for SQLite. 25,000,000 would be large.
When you're working with SQLite, you can test a lot of things on the desktop using the sqlite3 shell. For instance, if your query is something like:
SELECT * FROM MyTable WHERE Column='A';
You can do something like this:
EXPLAIN QUERY PLAN SELECT * FROM MyTable WHERE Column='A';
If you see output like this:
0|0|TABLE MyTable
It means SQLite is crawling the entire table to get the results.
In this case, adding an index would help:
CREATE INDEX MyTableColumn ON MyTable(Column);
Then, the explain above will give you something like this instead:
0|0|TABLE MyTable WITH INDEX MyTableColumn
If your WHERE clause is more complicated, you might need to make a compound index instead, since SQLite will only use one index per table.
CREATE INDEX MyTableFirstSecond ON MyTable(First,Second);
So in your case:
The rule of thumb with SQLite is simple: If you're going to search on it, it should be indexed.