php-telegram-bot / core

PHP Telegram Bot based on the official Telegram Bot API
MIT License
3.88k stars 955 forks source link

Limit the growth of the database #1003

Open damianperez opened 5 years ago

damianperez commented 5 years ago

🎉 Feature Request

Limit the growth of the database

Summary

Setting the days to save in logs of the tables in webhook

If the bot exceeds a number of users that any server service can handle, the tables begin to grow exponentially. It would be good if (for example, the request_limiter table) does not store more than what is previously configured in the bot initialization. With thousands of records in the db, cleanup is almost impossible. A possible solution would be to find an appropriate key in the tables so that you can do: insert ignore into .... on duplicate key update ... If not, compare the preset number of records in initialization with the amount in the table and clean them automatically.

lawrencegs commented 3 years ago

Yes please, my message table have 35 million+ rows & the /cleanup took hours...