We are using Dropwizard, JDBI, MySql 5.6 and mysql connector 5.1.32 and use a Pooled data source. In order to support emojis, the only way I have found is to call the query "SET NAMES utf8mb4" on the connection whenever the connection is obtained. But under load we are observing that this query takes a long time (around 222 ms).. Is there any alternative to this query? Things tried so far: 1. Tried setting charSet, characterEncoding on jdbc connection url 2. The columns in the table use utf8mb4 encoding and utf8mb4_unicide_ci collation 3. MySql is on RDS, not yet changed the character_set_server etc. variables on RDS
Asked
Active
Viewed 1,636 times
4
-
1Are you sure the connection has actually been established when you issue this initial query? There's nothing about it that I can think of to explain the delay. A dummy query, like `SET @one = 1;` could be used to prove or disprove whether *any* initial query is in fact slow under the observed conditions, thus ruling out `SET NAMES ...` as the actual problem. – Michael - sqlbot Oct 15 '16 at 02:13
-
Thanks for your comment.. Earlier, we were executing the SET NAMES utf8mb4 each time we got the connection from pool. Instead now I am using the initSQL or initialization query that can be defined in a Tomcat JDBC connection pool.. Based on the documentation, I think this should make sure that the SET names query gets executed only once when a connection is first created and added to the pool.. Right? – user1790625 Oct 15 '16 at 05:13