简体   繁体   中英

SQL queries versus search algorithms

I am kind of new in Android and SQL (not completely newbie, but not pro), so sorry if my question sounds bosh.

I am creating an Android application. For saving the users data I created a database using SQLite.

My problem is that I can't decide which method is faster:

  • get the data with SQLite queries, or
  • get all the data into a List (with an SQLite query) and then search in the list with searching algorithms.

For example: I have a database of Persons (around 1500-2000 records). In one page I want to show all the names, in an other I would like to show only the names who are married, in an other page I want to show the last 30 Persons who has been added recently etc...

Which method would be faster? Do the queries all the time for displaying the data, or get all the data, and than search for the relevant information while displaying?

在任何数据库过滤器中,使用数据库引擎的数据始终是首选。.因此,我认为您应该仅在数据库级别过滤结果集,而不使用android SDK将有助于性能和内存管理。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM