0

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.

2
  • 2
    Most likely network latency. Commented Mar 14, 2024 at 1:54
  • In addition to @JohnHanley's comment, there are other factors affecting performance aside from hardware configuration and latency. Please check if your workload is performance-intensive as it may also be one of the reasons for the lackluster performance. Please check this documentation on Cloud SQL general performance tips as this may help improve overall performance. Commented Mar 14, 2024 at 14:38

1 Answer 1

1

Posting as a community wiki based on previous comments:

As per @JohnHanley:

Most likely network latency.

In addition, there are other factors affecting performance aside from hardware configuration and latency. Please check if your workload is performance-intensive as it may also be one of the reasons for the lackluster performance. Please check this documentation on Cloud SQL general performance tips as this may help improve overall performance.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.