Make WordPress Core

Opened 14 years ago

Closed 13 years ago

#15915 closed defect (bug) (duplicate)

Verbose rewrite rules trigger a query for every page on options-permalink

Reported by: nacin's profile nacin Owned by:
Milestone: Priority: normal
Severity: normal Version:
Component: Rewrite Rules Keywords: has-patch 3.2-early
Focuses: Cc:

Description

This was reported yesterday (I think) in IRC. Basically, verbose rewrite rules cause one query to be triggered for every page, on options-permalink.php. This surely can be done in probably one query total.

This is not a regression and could be punted. But it's also probably a small fix.

Attachments (2)

15915.diff (2.1 KB) - added by greuben 14 years ago.
15915.2.diff (1.1 KB) - added by greuben 13 years ago.

Download all attachments as: .zip

Change History (10)

#1 @nacin
14 years ago

A single call to get_pages() as a way to put the queried pages in cache, in WP_Rewrite::page_uri_index(), should reduce these. Otherwise we're calling get_page() when we call get_page_uri().

We're also doing a query for every page for any attachments, and then a new query for each attachment for each page when we call get_page_uri(). Not sure if there's an easy way to prefetch all of that without more churn.

Tempted to punt now and deal with it later. That whole function is very ugly.

#2 @scribu
14 years ago

  • Keywords needs-patch added
  • Milestone changed from 3.1 to Future Release

#3 @nacin
14 years ago

  • Keywords 3.2-early added

@greuben
14 years ago

#4 @greuben
14 years ago

  • Keywords has-patch added; needs-patch removed

#5 @nacin
13 years ago

  • Milestone changed from Future Release to 3.3

@greuben
13 years ago

#6 @greuben
13 years ago

15915.2.diff reduces number of queries made for pages.

For 100 pages(12 subpages) and 10 attachments, number of queries without patch is 247 and with patch is 139.

#8 @duck_
13 years ago

  • Milestone 3.3 deleted
  • Resolution set to duplicate
  • Status changed from new to closed

Invalidated by #16687 and [18541].

Note: See TracTickets for help on using tickets.