Search code examples
yiitagsseometa

Yii - generation of page meta information from DB


I need help regarding generating meta tags from database and setting them in different controller actions.

I have a table in DB, where I store meta information (keywords, description) for each controller action. I want to select this values in every action and set the tags fetched from DB using registerMetaTag().

What I want to know is how much this queries will effect page load time, and if there is a better approach for doing this?

Thanks, Mark


Solution

  • This will be nearly unnoticeable if your database is set up traditionally. It will add 10,000ths of a second to load times for each query.

    For such low frequency data though, you should be caching heavily, as you know it will not be changing often. This means the hit in performance will be negligible as it's pulled from a file/mem store/memory table depending how your caching is set up.

    This is all a generalization of course, but then so was the question. If you've got any special set up or more specific optimization issues just comment or open a new question.

    P.S
    Don't micro optimize. Just do it, analyse the impact, decide if it needs performance improvement, and to what degree.

    http://www.codinghorror.com/blog/2009/01/the-sad-tragedy-of-micro-optimization-theater.html