List:General Discussion« Previous MessageNext Message »
From:Thimble Smith Date:September 20 1999 4:41pm
Subject:Re: discussion board based on mysql - numbering format advice ?
View as plain text  
At 19:28, 19990920, chas wrote:
>Maybe I'm misunderstanding you here but this looks like a 
>parent-child relationship. I tried one of these before 
>because it's an infinitely scalable solution .... the problem 
>that I ran into was that displaying an entire thread required 
>a recursion with multiple sql queries. This slowed things down. 

Chas, we had a discussion on trees not too long ago on this list
("recursive subqueries" thread).  The end result is pretty much
that SQL isn't too great for doing this stuff, and you have to
hack around it one way or another.  The elegant hack is to add to
the server a special way of handling graphs.  That's on the TODO
list, but not coming up any time soon.

In the mean time, using a CHAR field w/ a separator seems pretty
reasonable.  Your queries shouldn't be too slow, because MySQL can
use indexes on queries like:

    SELECT * FROM msgs WHERE id LIKE '3.21.14.%';

You might want to make your first message have id '1.0' instead of
id '1'.  That way you can SELECT ... WHERE id LIKE '1.%' and get the
correct results (the entire thread).  If you tried WHERE id LIKE '1%'
then obviously you're going to get '14' and so forth.

Tim
Thread
discussion board based on mysql - numbering format advice ?chas20 Sep
  • Re: discussion board based on mysql - numbering format advice ?Danny Carroll20 Sep
  • Re: discussion board based on mysql - numbering format advice ?John Jacques20 Sep
Re: discussion board based on mysql - numbering format advice ?chas20 Sep
Re: discussion board based on mysql - numbering format advice ?chas20 Sep
  • Re: discussion board based on mysql - numbering format advice ?Thimble Smith20 Sep
    • Re: discussion board based on mysql - numbering format advice ?chas21 Sep
      • Re: discussion board based on mysql - numbering format advice ?Benjamin Pflugmann21 Sep
        • Re: discussion board based on mysql - numbering format advice ?chas21 Sep
          • Re: discussion board based on mysql - numbering format advice ?Thimble Smith21 Sep
            • Re: discussion board based on mysql - crazy methodfelix k sheng21 Sep
          • Re: discussion board based on mysql - numbering format advice ?Bob Kline21 Sep