I’m developing an articles site. Should I store articles views on the same table
e-g: should i create a views field in site_ARTICLES table or i should create a new table for that (site_articles_views)..
which one is most optimized?
which one way will create low load on sql database?
You can store article views in your
site_articlestable if you need nothing more than a simplecount(*)of them. You could then just increment a newarticle_viewscolumn when a particular article is viewed:If however, you want to do more, such as:
Then you should use a separate table – perhaps with the following as potential columns:
It depends entirely on what you want to achieve. Just a new
article_viewscolumn would be “most optimized”, but only if that is the limit of the functionality required.