Part of SEO now is improving the time it takes for a webpage to download to the user’s computer – the quicker it loads, the better.
There are many ways to shave off a half second here, or half second there (for example place your common images into a sprite and place them using CSS as opposed to downloading them all one after another), but there is so much more that your can do!
We all know about placing as many (if not all) of our CSS and javascript into one or two files (as opposed to seven or eight), and only loading the javascript files at the bottom of the page instead of in the head tags is another way to speed up the download time.
That’s the easy stuff! What about the back end stuff? You can optimise database queries and squeeze out even more milliseconds!
For example, a MySQL database will store a date in a yyyy-mm-dd format. In order to display it in the standard dd-mm-yyyy format the standard approach is to get the date out of the database and using PHP, explode it then put it back together again the desired format.
There is a better way!
Date_Format() is a MySQL Function that can be used in a MySQL Query to, as the name suggests, format dates, e.g:
What this line of code is doing is fetching the date from table and formatting it into the dd / Mmm / yyyy format (for example ‘04 / Jun / 2010′), ready for processing in our PHP script. Of course there are many ’specifiers’ that can be used to customise the results as are required by your script, for example %D will show the day of the month with the English suffix (0th, 1st, 2nd, 3rd, etc). As a side-note, ranges for the month and day specifiers begin with zero due to the fact that MySQL allows the storing of incomplete dates such as ‘2014-00-00′.
For a full list of specifiers for the Date_Format function, visiting the MySQL Date and Times Reference Manual.
There’s a whole chapter in the MySQL Reference Manual dedicated to optimising which is definately worth reading, as squeezing every little bit of performance out of the database can help.







