[wp-hackers] Unique permalinks vs. unique post slugs

Otto otto at ottodestruct.com
Wed Dec 17 05:30:21 GMT 2008

On Tue, Dec 16, 2008 at 4:45 PM, scribu <scribu at gmail.com> wrote:
>> That check would be quite expensive, actually, as it would require
>> that you verify every "part" of the permalink in a page request. As it
>> stands now, it merely figures out the most specific part (easy to do)
>> and looks for a matching result. One database hit instead of several.
>> No result = 404. No verification of anything needed.
> What about nested pages? You can have pages with different parents and the
> same slug. Why isn't that expensive?

Pages are different. Each page URL is individually built and matched
against to start with. So if a page URL matches completely, then
everything else is overridden and the page is directly pulled.

This is actually quite expensive when you scale it up, because if you
have LOTS of pages, then the page permalink URLs list gets quite large
and slow to pull out of the DB. But, since most sites have a low Page
count, it's not expensive enough to mess with.

More information about the wp-hackers mailing list