Programming in mysql: MySQL structure of website with parent and child topics on newest questions tagged mysql – Stack Overflow
I am building a website that has a parent/child structure for various topics. (Too explain it a bit more, it actually has 4 levels, so:
parent < child < 2nd child < 3rd child) Currently I have a table for each level in MySQL. Each child has a row that refers to the parent’s id and primary key. The issue that I am having is that i see no way to create a list that shows the sub topics like that shown below:
Food Fruit Red Cherry Yellow Banana Meat Beef Pork
I have thought about using a single hierarchical table like that on: http://mikehillyer.com/articles/managing-hierarchical-data-in-mysql/ that i know can output a list like that.
However, the issue with that is that table could easily have millions of posts (assuming this gets of the ground) and a recursive function that sorts through it every time a page is requested seems like it would take a long time to load.
Although i recognize it is not a great question and answer site, I was wondering if anyone knew how Yahoo Answers stores their categories and subcategories as it seems similar to what I need to do. Are there any sites that have a category/subcategory database that anyone can provide information about?
Programming in mysql: programming-in-mysql