私は大きな SQLite データベース (45MB) を持っています。INNER JOIN を使用して、さまざまなテーブルからデータを取得します。ただし、動作が非常に遅いです。たぶん、私がテストしている携帯電話(Samsung Galaxy Ace)次第です。クエリを非常に高速にするにはどうすればよいですか? a) テーブルのインデックスを作成する b) 必要なテーブルを含む新しいテーブルを作成する c) あなたが推奨する他の方法
私はテーブルを取っています:entry、r_ele、k_ele、sense、glossをJOINで。
query = "SELECT" + " e.id AS _id," + " ke.id AS ke_id,"
+ " ke.fk as ke_fk," + " ke.value as ke_value,"
+ " re.id AS ke_id," + " re.fk as re_fk,"
+ " re.value as re_value," + " s.id AS s_id,"
+ " s.fk as s_fk," + " g.id AS g_id," + " g.fk as g_fk,"
+ " g.lang," + " g.value as g_value" + " FROM entry e"
+ " INNER JOIN k_ele ke ON e.id = ke.fk"
+ " INNER JOIN r_ele re ON e.id = re.fk"
+ " INNER JOIN sense s ON e.id = s.fk"
+ " INNER JOIN gloss g ON s.id = g.fk"
+ " WHERE g.lang IS NULL AND g.value like '"
+ lookingFor + "%' GROUP BY g.value LIMIT 5 ";