I was wondering whether it is better performance wise to select x rows with one query or to do select y rows x times?
I'm trying to build a forum with nested threading. Right now, the way I retrieve the nested replies is with recursive calls to the function and additional queries to get the children (WHERE parent_id = x). If there's a lot of nesting that can be a lot of queries. Also, I haven't yet implemented a way to limit the results returned (although, it's trivial). This would be easy if it were flat threading.
I thought about making parent_id a string instead of an integer, e.g. "1/3/14/21" but I don't see how that could improve performance. I'm also not sure of how to duplicate the recursive nature with a single query...or what the query would look like.
Thanks for your time.