WordPress.org

Make WordPress Core

Opened 3 years ago

Last modified 7 months ago

#18315 reopened enhancement

Add an index to the GUID column in the posts table

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

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 3 years ago.
Add an index to guid column during upgrade

Download all attachments as: .zip

Change History (9)

alexkingorg3 years ago

Add an index to guid column during upgrade

comment:1 alexkingorg3 years ago

  • Keywords has-patch added

comment:2 alexkingorg3 years ago

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

comment:3 nacin3 years 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 alexkingorg3 years 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().

comment:5 c3mdigital9 months ago

  • Keywords close added; has-patch removed
  • Resolution set to wontfix
  • Status changed from new to closed

Suggesting close based on Nacin's comments above.

comment:6 jeremyfelt9 months ago

  • Keywords dev-feedback added; close removed
  • Resolution wontfix deleted
  • Status changed from closed to reopened

I'd actually like to hear more reasoning on this before we close it.

I've often wanted to use the guid column as a way to verify uniqueness of content rather than just a placeholder for something that gets put into RSS feeds. Relying on a guid would be much nicer than doing meta queries for some of the stuff I've done in the past.

comment:7 SergeyBiryukov8 months ago

  • Keywords has-patch added

comment:8 nacin7 months ago

Agree with keeping this ticket open.

Note: See TracTickets for help on using tickets.