Surendra Rathore
Surendra Rathore

Reputation: 139

Very very slow JDBC performance in Tomcat8 compared to Java Application

I am creating a simple JDBC connection and executing a prepared statement. The query returns 10 rows and it takes around 20 secs to execute the query in simple Java application.

When I deploy this as a WAR File in tomcat and the same query is executed by a servlet it takes around 3 to 4 minutes, sometimes more.

Not able to figure out the possible reason.

Upvotes: 3

Views: 1285

Answers (1)

Surendra Rathore
Surendra Rathore

Reputation: 139

It's been long. But if someone is still looking.

The root cause for the slowness was presence of a Join in the SQL. Although the join was faster in SQL Developer but I think when invoked from JDBC it was using a different and longer execution plan.

I splitted the join into two individual queries and it worked fine.

Upvotes: 2

Related Questions