Falling off a performance cliff with group_concat in Google Cloud SQL

I started to write this article as the performance of some of my mysql queries had gone off a cliff. This was related to my use of the GROUP_CONCAT function. This rolls up a set result set and shows the passed in row values concatenated. Handy for reporting, but not much else. In the highly memory constrained world of Google Cloud SQL using this on a well indexed set of tables (albeit it with multiple left outer joins in place) pushed a regularly executed query for a few hundred milliseconds to 6 to 9 seconds. Disaster.
I pulled the db over to my dev machine (copy of prod) and ran the query there. No problem. I am concluding that the GROUP_CONCAT was the bad guy here. I found another way to achieve my goal, but this cost me an afternoon and a lot of fretting before I got out of the woods.

MySql is not bad, but occasionally it bites.


Comments

Popular posts from this blog

Building a choropleth map for Irish agricultural data

Early Stopping with Keras

AutoCompleteTextView backed with data from SQLite in Android