datacite / lupo

DataCite REST API
https://api.datacite.org
MIT License
12 stars 8 forks source link

Add/Remove Indexes - Metadata Table #1128

Closed kaysiz closed 8 months ago

kaysiz commented 9 months ago

Purpose

We have an incomplete index that is causing the query to do a filesort in the filter. The first part of the query uses index to fetch record but other part is now using filesort.

=> EXPLAIN for: SELECT `metadata`.* FROM `metadata` WHERE `metadata`.`dataset` = 38 ORDER BY created DESC
+----+-------------+----------+------------+------+------------------------------------+-----------------+---------+-------+------+----------+---------------------------------------+
| id | select_type | table    | partitions | type | possible_keys                      | key             | key_len | ref   | rows | filtered | Extra                                 |
+----+-------------+----------+------------+------+------------------------------------+-----------------+---------+-------+------+----------+---------------------------------------+
|  1 | SIMPLE      | metadata | NULL       | ref  | dataset_version,FKE52D7B2F4D3D6B1B | dataset_version | 8       | const |    7 |    100.0 | Using index condition; Using filesort |
+----+-------------+----------+------------+------+------------------------------------+-----------------+---------+-------+------+----------+---------------------------------------+

closes: #1125

Approach

Open Questions and Pre-Merge TODOs

Learning

Types of changes

Reviewer, please remember our guidelines: