sqlite retains the first 20,000 entries

There is a problem with the power record, the data has reached 170,000, and it takes a few seconds to draw the power curve of a new mobile phone!

This should be fine:

public void insert(ContentValues values) {
    SQLiteDatabase db = getWritableDatabase();
	db.insert(TableName, null, values);
	db.execSQL("delete from battery where _id not in (select _id from battery order by _id desc limit 0,20000)");
	db.close();
}

Guess you like

Origin blog.csdn.net/sonichty/article/details/123307174