The CreatorCon Call for Content is officially open! Get started here.

Child\Parent Relationship on same table

Bhadley
Kilo Expert

Hey all,

Had a random question for developers out there. Are their any risks involved in having a child-parent relationship between two records on a single table? I know this ability is locked out to all but admins on most SN features so I am curious if this is just a bad practice when it comes to process or if there is a risk to the tables themselves when doing this?  

1 ACCEPTED SOLUTION

bernyalvarado
Mega Sage

Hi Bhadley, it can be done and there are valid use cases for it. A good example is task, where one task may need to have other child tasks associated to it.



As for the risks, you just have to be careful of any type of recursive logic while writing/editing script that deal with your child/parent relationship. A recursive logic issue may end up in a performance degradation and symptoms of it may also be visible in some logs that may be just evidence that something is not right.



Thanks,


Berny


View solution in original post

2 REPLIES 2

bernyalvarado
Mega Sage

Hi Bhadley, it can be done and there are valid use cases for it. A good example is task, where one task may need to have other child tasks associated to it.



As for the risks, you just have to be careful of any type of recursive logic while writing/editing script that deal with your child/parent relationship. A recursive logic issue may end up in a performance degradation and symptoms of it may also be visible in some logs that may be just evidence that something is not right.



Thanks,


Berny


Thanks for the info. I prefer not to do it this way as it seems messy, but good to know other tables are using it without breaking. Thanks again!