I've created a table that holds items according to categories:

```
+------------+---------------------+------+-----+-------------------+----------------+
| Field      | Type                | Null | Key | Default           | Extra          |
+------------+---------------------+------+-----+-------------------+----------------+
| id         | bigint(20) unsigned | NO   | PRI | NULL              | auto_increment |
| name       | varchar(30)         | YES  |     | NULL              |                |
| category   | varchar(30)         | YES  | MUL | NULL              |                |
| timestamp  | timestamp           | NO   |     | CURRENT_TIMESTAMP |                |
| data       | mediumblob          | YES  |     | NULL              |                |
+------------+---------------------+------+-----+-------------------+----------------+

```

Old data is deleted using a [sliding window technique](https://dba.stackexchange.com/questions/20036/implementing-a-circular-buffer-sliding-window-in-mysql#comment33749_20036), meaning that only the last `N` items in each category are kept in the table.

How can I keep track the total number of the items per category, and the timestamp of the first item in the category?

**Edit** - `COUNT` and `MIN` on the original table won't work, because this is a Sliding Window data structure meaning that the first items have already been deleted.