I have a simple query and it takes only 0.2 seconds when I execute it on mysql console. But when I execute this query via jdbc from my runnable java jar, it takes about 15 seconds to get the data (20000 rows).
This query is so simple and the field in my WHERE clause is indexed and I am selecting two columns only.
I tried both BoneCP connection pool and simple jdbc connection. But in both cases the result is almost the same. It looks there is something taking too much time while getting data from mysql to java side but I can not imagine how. So I can not come up with a solution.
Query example:
SELECT eventType, eventId FROM users WHERE uid=55;
uid is indexed. It takes 0.2 second from mysql console but 15 seconds via my jar. By the way 15 second is really the time that takes while executeQuery() is being executed.
note: Before I am posting that question I searched in here, but could not find a real answer.
Solved. See my comment below