Sep 15, 2023 · Updated: Sep 18, 2023 · by Tim Kamanin
Imagine this: you want to optimize your Django project's page loading times. To do this, you've installed the magnificent Django Debug Toolbar that will provide you with the necessary insight into how many queries your page generates. You click on the SQL panel in the Debug Toolbar, and... you get the following error message:
Data for this panel isn't available anymore. Please reload the page and retry.
You might think: "Woot? I was supposed to debug my page, not the tool!"
This happens because the page you're trying to debug generates a lot of information (potentially about loads of database queries), and the Debug Toolbar can't handle that data in its memory. Luckily, there's a RESULTS_CACHE_SIZE
setting that you can increase and fix the issue.
Edit your project's settings.py
and add the RESULTS_CACHE_SIZE
variable. By default, its value is 25
. Try to set it to at least 1000
:
RESULTS_CACHE_SIZE = 1000
Reload the page and check the SQL panel. If the error persists, increase the RESULTS_CACHE_SIZE
value until you find a sweet spot.
Hey, if you've found this useful, please share the post to help other folks find it: