I have a large sqlite db. Its 185mb.
This query is taking about 5seconds and it returns 2 rows. I added an index to user.name than Content.user_id. It stills take many seconds. Can sqlite handle large files like this? Is there a simple fix for a private app like telling sqlite to put everything in ram on app startup? (Its C#.NET for dev use only).
select Content.*,name from user
join Content on Content.user_id=user.id
where user.name like 'some_name' order by some_col ASC;
Try the following:
LIKE 'some_name'with= 'some_name'. LIKE queries with underscore or percent sign will not perform as well as equality checks. Depending on the position of the first percentage sign or underscore they might be unable to use your index onuser.name.ANALYZE.Followup to your answer:
I think you have case-insensitive LIKE pragma enabled. This means that:
You should recreate your database and use
name COLLATE NOCASEin the definition of thenamecolumn of table users. Thus, all comparison tests on user names will be case insensitive, and so will your index be. This way, a case-insensitive LIKE can use the index also.