Results 1 to 3 of 3

Thread: mod_rewrite effects on querying database

  1. #1
    Join Date
    Jul 2006
    Posts
    36
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default mod_rewrite effects on querying database

    Hello, I have a wordpress blog that I'm just testing around.
    I've chosen "friendly" urls which look like this:
    http://www.self-made.us/2008/06/orga...n-of-material/
    where the link is in this format : /[year]/[month]/[title of post]/

    The "normal" link would look like this :
    http://www.self-made.us/?p=4
    where p equals the database primary key of which the table is indexed.

    My question is how in the world do you query the database using the first link? Do they really find the row by searching on the text-based "title of post" field? If so, this seems like such a huge performance hit, over having direct access to the primary key in integer form, as shown in the second link. Also consider that some blogs have hundreds and hundreds of pages.

    If you notice www.digg.com also does this, and they must store literally MILLIONS of pages. How can they access their data so quick, seemingly using a word-based search?

    So how does the first link actually work?
    Thanks!

  2. #2
    Join Date
    Oct 2006
    Posts
    183
    Thanks
    0
    Thanked 11 Times in 11 Posts

    Default

    I have wondered this looking at wikipedia :O

  3. #3
    Join Date
    Mar 2008
    Posts
    218
    Thanks
    7
    Thanked 19 Times in 19 Posts

    Default

    I played a bit with it, but never was sure about the performances hit. I only had small tables.
    Ok, what i did was strip the string. Well you're doing the same but you combine.
    2008 I would make a table, 06 a value of field month in the table, i would strip orga.. from the title string and put in field title. Finally, the complete title in another table where the date match would that of date of the first table. You than can match the substring with the complete string with the same date.
    Again this was only experimental and not very well tested.
    I hope someone can make some improvements so I can use it with a better implementation

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •