[wp-trac] Re: [WordPress Trac] #9559: Site search results can
include passworded posts
WordPress Trac
wp-trac at lists.automattic.com
Mon Apr 27 15:23:51 GMT 2009
#9559: Site search results can include passworded posts
--------------------------+-------------------------------------------------
Reporter: coffee2code | Owner: ShaneF
Type: defect (bug) | Status: assigned
Priority: normal | Milestone: 2.8
Component: General | Version: 2.7.1
Severity: normal | Keywords: has-patch
--------------------------+-------------------------------------------------
Comment(by Denis-de-Bernardy):
Replying to [comment:3 ryan]:
> There's no index on post_password, so this will likely seriously degrade
query performance.
No so. Or rather, only if there are multitudes of posts that have a
password. Else, it'll just filter out a result here and there.
Also note that, if the vast majority of posts happen to have no passwords,
and you look for posts without one as the only criteria in your query, the
optimizer will simply ignore that index: A seq scan, on which you filter
out those that have a faster, will generally be faster.
In fact, the likelihood is that you can even toss the following in,
without any noticeable degradation of speed:
{{{
AND ( post_password = '' OR post_author = $user_id )
}}}
The optimizer would then filter the results returned by the index used
based on that criteria, like this:
{{{
nested loop on index
for each row
check the above
break at $limit rows
}}}
--
Ticket URL: <http://core.trac.wordpress.org/ticket/9559#comment:6>
WordPress Trac <http://trac.wordpress.org/>
WordPress blogging software
More information about the wp-trac
mailing list