WordPress.org

Make WordPress Core

Opened 4 years ago

Last modified 9 months 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
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 4 years ago.
Add an index to guid column during upgrade

Download all attachments as: .zip

Change History (15)

@alexkingorg4 years ago

Add an index to guid column during upgrade

comment:1 @alexkingorg4 years ago

  • Keywords has-patch added

comment:2 @alexkingorg4 years ago

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

comment:3 @nacin4 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 @alexkingorg4 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 @c3mdigital21 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 @jeremyfelt21 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 @SergeyBiryukov20 months ago

  • Keywords has-patch added

comment:8 @nacin19 months ago

Agree with keeping this ticket open.

comment:9 @ircbot10 months ago

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

comment:10 @ircbot10 months ago

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

comment:11 @SergeyBiryukov10 months ago

  • Milestone changed from Awaiting Review to 4.0

comment:12 @DrewAPicture9 months ago

  • Keywords punt added

Seems like it's probably too late for this.

comment:13 @ircbot9 months ago

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

comment:14 @DrewAPicture9 months 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.

Note: See TracTickets for help on using tickets.