It is just a matter of choosing * from the table. Answer. Itβs more efficient to select (columns that you need) from the table.
The best example of senario for reading from a content provider is when the projection contains only the columns that you are going to use and you have a well-coded loop for reading data.
if you pass null for projection, it will take the same amount of time because all columns of the content provider will be returned on both calls.
If on the first call you pass the key_id for projection and the 2nd pass, you pass {key_id, key_email}, the second pass will take longer because the content provider returns more data
Actual time depends on how well you code the loops and what you do with the data in the loop. For example, if in each loop you execute getColumnIndex ("email"), it will take much longer than an optimized program that determines the column indices before entering the loop.
Note that there is no moveToFirst (), it is the fastest read loop for sqllite, the first call to moveToNext () makes moveToFirst () for you.
if (cursor !=null) { //get column indexes here while (cursor.moveToNext()){ //processing here } } cursor.close()}
source share