Forums

Large database, PythonAnywhere takes >2min to load compared to 5 seconds local

Hi there,

So I'm aware that my use case is definitely pushing it for this type of hosting as I have a very large database and PA storage is networked, so db hits are a lot more expensive. I've done some work in the past to optimise my pages to this end.

However, I didn't expect the difference to be this pronounced. If I load a table of 2.7m entries in my Django admin panel (which also has three filters, so at some point must evaluate what those filter values could be) on my local machine it takes 5 seconds, while on remote it instead loads for 2 minutes and 12 seconds.

My question is: is this magnitude of slowdown to be expected for any remote hosting solution? And should my PythonAnywhere app be this slow by comparison? Is there anything I can do to improve this for such a large database?

Thanks for the help!

Kirkmania

That does seem excessive. A shared environment will generally be slower than a local one, just because your local one is not really doing anything else. Are you using sqlite or MySQL? The difference between local and PythonAnywhere is going to be significantly bigger with sqlite.

I swapped over to MySQL a couple weeks back, which definitely sped things up at the time. And yeah for sure I agree, a whole otherwise unoccupied personal PC should be substantially quicker, but I wouldn't have thought to this degree :L

Is Postgres any better for something like this? I don't know what else I can do!

Postgres should be quicker - those servers have less contention, because it's a paid service.