WordPress.org

Make WordPress Core

Opened 23 months ago

Last modified 23 months ago

#18315 new enhancement

Add an index to the GUID column in the posts table

Reported by: alexkingorg Owned by:
Priority: normal Milestone: Awaiting Review
Component: Database Version: 3.2.1
Severity: normal Keywords: has-patch
Cc: nacin

Description

Running queries on the GUID column in the posts table is slow because the column is not indexed. The attached patch adds an index.

Note, this affects ticket #18286 - I will update that ticket with appropriate patches to reflect this request.

Attachments (1)

patch.diff (720 bytes) - added by alexkingorg 23 months ago.
Add an index to guid column during upgrade

Download all attachments as: .zip

Change History (5)

alexkingorg23 months ago

Add an index to guid column during upgrade

comment:1 alexkingorg23 months ago

  • Keywords has-patch added

comment:2 alexkingorg23 months ago

Ticket #18286 has been updated with a patch that also includes the change suggested here.

comment:3 nacin23 months ago

With the exception of the patch in #18286, there never really should be any queries run against post_guid.

I think to repair #18286, we'll need to do a LIMIT or something. I don't know if it's something we can realistically do for core.

comment:4 alexkingorg23 months ago

Let's chat about this at WCSF. The index costs very little, and I think the use case of using GUIDs to identify posts/pages to be sync'ed between WordPress instances is valid. GUID is perfect for this usage because the value never changes, it is not tied to the site URL, and it can be set as part of wp_insert_post().

Note: See TracTickets for help on using tickets.