Menu

1 / 2

Why telescope:clear Is Slow and How to Reclaim Disk in Seconds

DEV Community·Ivan Mykhavko·7 months ago
#Cz36hK49
#laravel#php#mysql#webdev#telescope
Long article (825 words) — no AI summary yet.
Reading 0:00
15s threshold

A while back I wrote about laravel-telescope-flusher - a tiny package I built to wipe Telescope data without waiting forever. It just hit 1,000 installs on Packagist 🎉, so it felt like the right time to actually back up the original post with real numbers, not just claims.

So I sat down, seeded a million Telescope entries on a fresh MySQL 8.0, and timed the three things you'd reach for: telescope:clear , telescope:prune , and telescope:flush . Spoiler: the gap is bigger than I expected.

Quick recap of why telescope:clear is slow

Two things kill it. First, the loop:

// vendor/laravel/telescope/src/Storage/DatabaseEntriesRepository.php public function clear () { do { $deleted = $this -> table ( 'telescope_entries' ) -> take ( $this -> chunkSize ) -> delete (); } while ( $deleted !== 0 ); // ...same for telescope_monitoring }

Enter fullscreen mode

Exit fullscreen mode

$chunkSize = 1000 .…

Continue reading — create a free account

Join HashtagPLUS to read full articles, follow hashtags, vote, and join the conversation.