[wp-trac] [WordPress Trac] #23336: Sticky Posts lack sanity bounding. If used too much, can severely degrade performance.

WordPress Trac noreply at wordpress.org
Fri May 24 16:02:17 UTC 2013


#23336: Sticky Posts lack sanity bounding. If used too much, can severely degrade
performance.
-----------------------------------------+------------------
 Reporter:  markjaquith                  |       Owner:
     Type:  defect (bug)                 |      Status:  new
 Priority:  normal                       |   Milestone:  3.6
Component:  Query                        |     Version:
 Severity:  normal                       |  Resolution:
 Keywords:  has-patch reporter-feedback  |
-----------------------------------------+------------------

Comment (by iandunn):

 Replying to [comment:14 mboynes]:
 > @iandunn, I would offer that it's the rare edge case site which needs
 more sticky posts than displays posts per page. And in that edge case,
 they're doing it wrong.

 I agree that they're doing it wrong, but it's not uncommon for users to
 forget to un-stick posts that they don't want to be sticky anymore, and
 just because someone's making a mistake doesn't mean WP can't handle the
 situation gracefully.

 In this case, I think the bottom line is that using a number like 10 is
 going to cause problems for a significantly larger number of people than
 100 will.

 [[BR]]

 > Better still, lets say you have 10 posts per page and you have 15 sticky
 posts -- wouldn't you wonder why there were 15 posts on your homepage, and
 think that was a bug?

 I don't think that's really what's happening here. Sticky posts don't
 count against the `posts_per_page` limit in the loop, they're added to it.
 So, in that hypothetical situation, the user would already be seeing 25
 posts on the page, and that behavior wouldn't change as a result of my
 patch.

 The reason the user didn't notice in @markjaquith's case is because their
 template was only displaying the first 3 posts from the loop, even though
 it contained 2,000+ posts.

 The limit only comes into play when the number of sticky posts exceeds it:

 `posts_per_page` = 10; 3000 posts in database, 15 are sticky; result = 25
 posts displayed
 `posts_per_page` = 10; 3000 posts in database, 75 are sticky; result = 85
 posts displayed
 `posts_per_page` = 10; 3000 posts in database, 150 are sticky; result =
 110 posts displayed
 `posts_per_page` = 10; 3000 posts in database, 1500 are sticky; result =
 110 posts displayed
 `posts_per_page` = 10; 3000 posts in database, 2500 are sticky; result =
 110 posts displayed

--
Ticket URL: <http://core.trac.wordpress.org/ticket/23336#comment:15>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software


More information about the wp-trac mailing list