Social media in Thailand was awash with grief and anger on Friday over the killing of 34 people, including 23 children, at the hands of a former policeman who rampaged through a preschool daycare centre before killing his own wife and child.

An opposition politician said the police and authorities had to reflect on the case to ensure there was no repeat of Thursday's killings at the northeast Thailand daycare centre, where tiny coffins were taken away from the scene.

"It's so heart-breaking. They were small kids, they did not deserve this. Some of them were still in their afternoon naps," said 29-year-old Bangkok resident Chamita Itthiponwitoon.

The 34-year-old attacker went on a rampage with a pistol and a large knife at the centre in the province of Nong Bua Lamphu – the worst mass killing by a single attacker in the country's recent history.

"Humanity, not tiny angels, died," wrote one Twitter user, identified as @psmyheart, who posted under a Thai hashtag that translates as #MassShootingNongBuaLamphu.

More than 4.7 million people sent posts with the hashtag by Friday afternoon, many with messages such as "RIP Children of Heaven" and "I hope you are reborn as angels in heaven".

On the Facebook page of the Mutahi Sawant Child Development Centre where the attack took place, hundreds of people posted condolences under the centre's last post before the massacre, an account of a visit the children made to a Buddhist temple in September.

'PEOPLE AT RISK'

Most of the child victims were aged between two and five, many killed with a machete-like blade farmers use to cut sugarcane, police said.

Authorities identified the attacker as a former policemen discharged from the force last year after being caught with methamphetamines. He was on trial on a drug charge.

He went home after the daycare centre slaughter and shot his wife and son before turning the gun on himself.

Amid the grief, questions are being raised about guns, drugs, mental health and the accountability of the security forces.

Thursday's attack comes two years after a mass shooting by an ex-soldier at a shopping mall and army base in Nakhon Ratchasima province, commonly known as Korat, in which 29 people were killed.

"The mass shootings in Korat and Nong Bua Lumpu reflect some problems in the army and police, including mental health and problems with command," opposition politician, Wiroj Lakkhanaadisorn, said in a post on Twitter shared 125,000 times.

"If the problems are not solved, it would mean that the lives of people are at risk from the people who have these weapons in their hands."

Twitter user @jaoohja touched a nerve with a post shared more than 14,500 times that included a photograph of some graffiti with the message: "Who do you call when the police murder?" (Additional Reporting by Artorn Pookasook in Bangkok; Writing by Kate Lamb; Editing by Robert Birsel)