Would adding an additional query to my site slow it down

ok so my site is dynamic and uses php and mysql. I run a couple of queries to build the structure dynamically but the way i’ve done it makes a long url

eg ‘http://www.mcsuk.org/what_we_do/Wildlife+protection/Report+wildlife+sightings/Report+wildlife+sightings

what i want to do is add a short url variable into my database against a specfic page and run a query to check if it exists. so for the above it could just be ‘http://www.mcsuk.org/sightings’ with the sightings being a variable in the ‘shorten’ column that is checked against the database and redirected to the full url page if it exists.

if i have a query on my index page that checks for a corresponding entry in the database before continuing on as normal or redirecting will it severly slow the site or will it be negligable? it will run this query everytime the home page is loaded.

hope that makes some kind of sense.


Your method is of course an option, but perhaps not the best suited option for your situation. How many pages are you going to want ‘short URLs’ for? It would probably be more efficient to use a URL rewrite or redirect via .htaccess. The difference in page speed for a short-URL query will most likely be negligible for a small/medium website, but it is certainly not the best solution.

the latter :slight_smile:

thanks for the replies. think i may do a test page see if it has an impact and see how many people actually want redirects.

I’ve done some redirects with .htaccess but its a little more involved so non-techy people in my company can’t do it as easily as just filling in an admin page.