Make WordPress Core

Opened 6 years ago

Last modified 2 years ago

#18315 reopened enhancement

Add an index to the GUID column in the posts table

Reported by: alexkingorg Owned by:
Milestone: Future Release Priority: normal
Severity: normal Version: 3.2.1
Component: Database Keywords: has-patch dev-feedback early needs-refresh
Focuses: Cc:


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

Download all attachments as: .zip

Change History (16)

6 years ago

Add an index to guid column during upgrade

#1 @alexkingorg
6 years ago

  • Keywords has-patch added

#2 @alexkingorg
6 years ago

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

#3 @nacin
6 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.

#4 @alexkingorg
6 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().

#5 @c3mdigital
4 years 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.

#6 @jeremyfelt
4 years 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.

#7 @SergeyBiryukov
4 years ago

  • Keywords has-patch added

#8 @nacin
4 years ago

Agree with keeping this ticket open.

This ticket was mentioned in IRC in #wordpress-dev by nacin. View the logs.

4 years ago

This ticket was mentioned in IRC in #wordpress-dev by simonwheatley. View the logs.

4 years ago

#11 @SergeyBiryukov
4 years ago

  • Milestone changed from Awaiting Review to 4.0

#12 @DrewAPicture
4 years ago

  • Keywords punt added

Seems like it's probably too late for this.

This ticket was mentioned in IRC in #wordpress-dev by DrewAPicture. View the logs.

3 years ago

#14 @DrewAPicture
3 years ago

  • Keywords punt removed
  • Milestone changed from 4.0 to Future Release

Annnnd no activity since I marked this for punt 3 weeks ago. Punting.

#15 @chriscct7
2 years ago

  • Keywords early needs-refresh added
Note: See TracTickets for help on using tickets.