title: Speed up select query in sqlite - Android
body: <p>My data base class is bellow :</p>
  
  <pre><code>public class DataBaseInstagram extends SQLiteOpenHelper {
  
      private static final int DATABASE_VERSION = 7;
      private static final String DATABASE_NAME = "Instagram";
      private static final String TABLE_PRODUCTS = "DetailImage";
      private static final String COLUMN_IMAGE_NAME = "imageName";
      private static final String COLUMN_IMAGE_ID = "imageID";
  
      public DataBaseInstagram(Context context) {
          super(context, DATABASE_NAME, null, DATABASE_VERSION);
      }
  
      @Override
      public void onCreate(SQLiteDatabase db) {
          String CREATE_PRODUCTS_TABLE =
                  "CREATE TABLE " + TABLE_PRODUCTS + "(" + COLUMN_IMAGE_NAME + " TEXT UNIQUE," + COLUMN_IMAGE_ID + " TEXT UNIQUE" + ")";
          db.execSQL(CREATE_PRODUCTS_TABLE);
          String INDEX = "CREATE UNIQUE INDEX products_index ON "
                  + TABLE_PRODUCTS + " (imageName, imageID)";
          db.execSQL(INDEX);
      }
  
      @Override
      public void onUpgrade(SQLiteDatabase sqLiteDatabase, int i, int i1) {
  
      }
  
      public List&lt;ExistImage&gt; select() {
          String sql = "select * from " + TABLE_PRODUCTS;
          SQLiteDatabase db = this.getReadableDatabase();
          List&lt;ExistImage&gt; lstExistImages = new ArrayList&lt;&gt;();
          Cursor cursor = db.rawQuery(sql, null);
          if (cursor.moveToFirst()) {
              do {
                  ExistImage existImage = new ExistImage();
                  existImage.setImageName(cursor.getString(0));
                  existImage.setImageID(cursor.getString(1));
                  lstExistImages.add(existImage);
              } while (cursor.moveToNext());
          }
          cursor.close();
          return lstExistImages;
      }
  }
  </code></pre>
  
  <p>I use <code>INDEX</code> in my table .Will my <code>select</code> queries become faster?</p>