Ok basicly i'm writing a bullitan board app becuase i have some very specific demands and it looks good on a resume. My problem is righ tnow when it goes to display an article, every time i hits on a responce it queries again for each responce to find responces to it and so on.... i could reduce all the queries but it cause problems id have to solve with code.
righ tnow the table looks like this..
table(
data....
int id,
int refid
)
it goes through looking for eery article with refid zero. then for each one it goes through looking for all articles with refids matcing that articles id. and so on and so on recursively
i want to make the database look liek this.
table(
data.......
int id,
int refid,
int orgrefid
)
what i would do i query for the root articles again, but this time i would only query for everything whos orgrefid matches the rootarticles id. reducing a possible 400+ queries to a maximum of 21 (20 root articles per page)
Now the problem becomes how do i sort these intoa tree similar to what i already have.
You can see the current setup at http://www.xaosinc.com/~sanityimp/bb.php
speed has been a major user concern. I'v alreadyreworked a lot of bad code since then so its faster than when i wrote it 7 months ago but this is still a major issue since as threads grow larger, the database has to handel more quieries so that it eventually bogs down the system.