CodeIgniter Forums

Full Version: performance problem
You're currently viewing a stripped down version of our content. View the full version with proper formatting.

El Forum

[eluser]timaksu[/eluser]
this is mainly a mysql question but im using it in a codeigniter application..anyway..i have a single database table that handles most of my website "Content". this mainly includes things like regular site comments (to news posts etc), blog posts, blog post comments etc. i was wondering if their would be a performance issue here. would it make a different to store comments in the comment table and blog posts in the blog table rather than having both in the same one? i like the way i have it now. it works well for my system. so if there isnt a huge problem i would like to leave it unchanged. Smile

El Forum

[eluser]Michael Wales[/eluser]
Despite the obvious disorganization benefits you will only have a problem in terms of "finding content." I'm assuming you return this content via an id field or a slug - either way, you need to have these fields indexed.

The problem will come in when you have 300 blog posts and 20,000 comments. Let's say your front page features the 10 most recent posts - you are forcing the database to look through 20,300 rows to find the 10 you want, rather than just searching through 300 rows.

Good indexing will reduce the time it takes to find the rows you want but it really should be tackled with individual tables.