| 4 | |
| 5 | Looking at the very commonly-used core functions for getting meta data, they seem to fetch all the meta data of specific IDs into a cache at once, and then grab specific values from that cache by the key, so an index on the meta key will not help speed this up. |
| 6 | |
| 7 | And index on `post_id, meta_key` would speed things up if WordPress fetched single records by the post ID and meta key. |
| 8 | |
| 9 | Core Team, am I reading this correctly? Because this could be the start of a course change that will bring much performance improvement. |
| 10 | |
| 11 | Importantly, if access to `wp_postmeta` is done by `post_id`, the table should have a primary index in that field, and it's currently indexed by `meta_id`, which doesn't help much. |
| 12 | |
| 13 | A primary index by `post_id` should be lightning fast, because all the meta data records for a given ID would be contiguous and require the smallest possible number of block fetches in the database. |