I'm running a postgres database in CloudSQL, and I'm noticing that every single query that I run is about a factor 4-5 slower compared to when I run it on a local postgres instance of the same version on a cheap laptop.
My question is: Is there a way for me to figure out what's bottlenecking me here? And what would be your recommendation on how to improve performance using only services that are available on GCP?
I'm not using large tables, and my total database size is only 5GB. I've tried a number of vertical scaling options:
- Increasing disk size by a factor 10 (from 25gb to 250gb), on paper this should increase the read/write throughput.
- Increasing memory from 8gb to 16gb
- upgrading the machine to have 2, 4, or 8 cores.
None of these upgrades seem to make a meaningful difference. So my guess is that the problem lies in some factor that I have no control over, e.g. overhead from virtualization, latency accessing the SSD, etc.