My dd went to my mother's funeral at age 5 and my MIL's funeral at age 7. She barely remembers my mother's funeral although she was fairly close to her, but has very clear memories of my MIL's funeral, although she did not know her. Part of the difference is, of course, the age but other reasons are that my dh's family had an open casket funeral and they are very dramatic people (my SIL threw herself across the casket). So dd remembers her aunt's behavior and seeing a dead body, which she found just "weird". I will note that she did not relate to the viewing as seeing her grandmother for the last time or saying good bye. To her, it was just a dead body, a shell, and it was meaningless and she did not (and still does not) understand displaying it. In re my mother's funeral, all she really remembers is that I cried (I've cried about 3 times in my entire adult life, so seeing me cry was a huge event for dd). I don't think it was a bad thing that she saw me cry.
My issue with small children is that unfortunately I have seen them disrupt the service in highly inappropriate ways (singing, running around, throwing stuff). I don't believe a parent's desire to educate their child about death or funerals trumps the need of mourners to have an appropriate service.