I want to create something like Snapchat that will automatically delete row after 24 hours in php/mysql.
I have read about cron jobs,but it slows down apps,so i was wondering if there is other way to do it?
What you're looking at is something effectively like this:
DELETE FROM snaps WHERE created_at<=DATE_SUB(NOW(), INTERVAL 1 DAY)
So long as you populate
created_at and index it, this should run fairly quickly. If you have lots of records, and by that I mean over 100 million, you'll need to space that out:
DELETE FROM snaps ... LIMIT 10000
Where you can do it in chunks of 10K or whatever works best.