Make WordPress Core

Changes between Initial Version and Version 1 of Ticket #45354, comment 7


Ignore:
Timestamp:
08/17/2023 12:22:29 AM (17 months ago)
Author:
galbaras
Comment:

Legend:

Unmodified
Added
Removed
Modified
  • Ticket #45354, comment 7

    initial v1  
    22
    33Also, as I've mentioned, the index can be created in 2 ways, and this will yield different results - one may help more and one may hinder more. It really depends on the context.
     4
     5Looking 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
     7And index on `post_id, meta_key` would speed things up if WordPress fetched single records by the post ID and meta key.
     8
     9Core Team, am I reading this correctly? Because this could be the start of a course change that will bring much performance improvement.
     10
     11Importantly, 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
     13A 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.