Hi @Ityumenev and welcome to the Mattermost forums!
Deleting posts from the database is a bit more complicated, because there are a lot of cross references which are handled in the application, so there is no officially supported way to do that, but you might have luck with scripts like this one: