WordPress / WordPress/performance

Revisit indexes for DB performance

Open
#132 90 comments 13 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

[Type] Feature Needs Discussion
Dominant language
PHP
Stars
461
Forks
165
Avg merge
11h 12m
Merged PRs (30d)
28

Description

As discussed with @tillkruss :

I was having some slow queries – specifically one query that was already described 6 years ago here:
https://core.trac.wordpress.org/ticket/33885

The last comment by OllieJones https://core.trac.wordpress.org/ticket/33885#comment:86 pointed at hints on how it could be indexed better and he created a plugin that updates the indexes accordingly:

https://wordpress.org/plugins/index-wp-mysql-for-speed/

TL;DR of what the plugin does here:
https://www.plumislandmedia.net/index-wp-mysql-for-speed/tables_and_keys/

Applying those indexes has, in some queries, saved me 80%+ in DB time. This seems more apparent on larger sites with a ton of meta data (e.g. woocommerce)

He mentioned to me he plans on doing a PR to core eventually.

I'd like to tag him here in but i don't have his github handle.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reading the linked Trac ticket, the index-wp-mysql-for-speed plugin, and its tables-and-keys documentation. Compare the proposed indexes with the performance plugin's current database schema and identify representative slow queries. Done means an agreed index design with evidence that it improves query performance without unacceptable migration or compatibility costs.

Written by the indexing model from the issue text.

Assessment

Tech stack
mysql, php
Domain
databases, performance
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.