I am using a cloud sql instance (db-n1-standard-1
1vCPU, 3.75 GB) for one of my projects.
I noticed that the queries are very slow.
For example, a SELECT query on an empty table (SELECT * from customer) takes 0.03 sec, while on my Macbook Pro Retina 2013 MAMP local database takes 0.00057 sec.
My region is set to ‘Europe-west1’ (Belgium) and I am in Italy.
To test I connected cloud sql db to Mysql Workbench on my macbook.
How can I increase performance? So it is really unusable.
For information the database engine is InnoDB.
Thanks in advance! 🙂
europe-west6 (Zurich) might be faster since it’s closer to you, but…I mean, it’s the internet. Of course it’s going to be faster by several orders of magnitude on a local machine vs. the internet. You’re measuring apples to oranges, and it may be that if your application requires latency below a certain threshold, then an internet-based data store won’t be a workable solution. If you require consistency across locations, then it is what it is though, and there are strategies to help with that (aggressive local cacheing, etc), but at some point, you’re dealing with internet latency.
Edit: Also, if you’re going to test timing, you should really evaluate connection time vs. transaction time, which will tell you more about where your latency is coming from. Doing some network evaluation on just round-trip latency from you to where the server is located (tracert and/or just ping to a known server nearby will help with this) is a good idea as well.
Barring something else going on (and we’d need more information to evaluate), my guess is that it’s not Cloud SQL that’s slow, it’s the internet.