A sand-boy was just that...a lad who went around town hawking sand. Housewives doubtless used it as a scouring agent, it would have been sprinkled on pub and stable-floors etc. The phrase first appeared in exactly the 'happy' form in a publication called 'Life in London' in 1821. That referred to someone who (quote) "appeared to be as happy as a sand-boy who had unexpectedly met with good luck in disposing of his hampers" of sand.
Some sources suggest a.) that sand-boys were happy because they spent all their money on drink or b.) that they actually worked in pubs brushing up the sand at the end of a drinking-session...any coins they found were theirs to keep and that's what made them so happy.
Nice ideas, but the quote offered above is certainly the oldest reference to sandboys being happy, so I think you can safely assume that they were happy for no other reason than that they had simply managed to get rid of the wretched - and extremely heavy - stuff!