After review the method "image_tag_get_all" of <sqlalchemy>/api.py, we're trying to order the list by created_at. However, it's meaningless from the end-user perspective. Since there is no priority for tags and we can't say one tag is more useful/important than another one. And even worse, it may introduce some performance issue.
=============================================================
mysql> explain SELECT image_tags.created_at AS image_tags_created_at, image_tags.updated_at AS image_tags_updated_at, image_tags.deleted_at AS image_tags_deleted_at, image_tags.deleted AS image_tags_deleted, image_tags.id AS image_tags_id, image_tags.image_id AS image_tags_image_id, image_tags.value AS image_tags_value FROM image_tags WHERE image_tags.image_id = 'c67d1ff2-c5c7-411b-9bf0-2c723e746434' AND image_tags.deleted = 0 ORDER BY image_tags.created_at ASC;
+----+-------------+------------+------+---------------------------------------------------------+------------------------+---------+-------+------+-----------------------------+
| id | select_type | table | type | possible_keys | key | key_len | ref | rows | Extra |
+----+-------------+------------+------+---------------------------------------------------------+------------------------+---------+-------+------+-----------------------------+
| 1 | SIMPLE | image_tags | ref | ix_image_tags_image_id,ix_image_tags_image_id_tag_value | ix_image_tags_image_id | 110 | const | 2 | Using where; Using filesort |
+----+-------------+------------+------+---------------------------------------------------------+------------------------+---------+-------+------+-----------------------------+
1 row in set (0.01 sec)
I think we might have created_at ordering in order to ensure tags show up in the same order each time. How would this behavior cause a performance problem?