There could be several reasons why the same query executed through JDBC takes an indefinite amount of time to run while it is completed in only one minute through pgAdmin. Some of the common reasons are:
Network Latency: If the JDBC client and the PostgreSQL server are located in different geographical locations, the network latency can cause delays in data transmission leading to slow query execution times.
JDBC Driver: The JDBC driver used to establish the connection between the client and the server could be outdated or incompatible, which could result in performance issues.
Client System Resources: The performance of the client system could also affect the query execution time. A system with insufficient resources like RAM, CPU, or disk space could lead to slow query execution times.
Connection Pooling: If the JDBC client is not using connection pooling, it could lead to slow query execution times as each query requires establishing a new connection to the server.
Query Optimization: It is possible that the same query is optimized differently by the JDBC client and pgAdmin. pgAdmin may be using cached results or may have a different execution plan for the same query, leading to faster execution times.
Please start posting anonymously - your entry will be published after you log in or create a new account. This space is reserved only for answers. If you would like to engage in a discussion, please instead post a comment under the question or an answer that you would like to discuss
Asked: 2021-08-19 11:00:00 +0000
Seen: 8 times
Last updated: Aug 17 '22
What is the procedure for using pg_restore on Windows with Docker?
Due to SyntaxError, why am I unable to create a TIMESTAMP WITH TIMEZONE column in postgres?
What are the benefits of choosing sqlalchemy.types instead of sqlalchemy.dialects.mssql?
What is the method for placing parentheses in column names when creating a table using an SQL query?
How can larger BLOBs be compressed without being inlined?
How can pgcrypto be used to secure data on Postgres?
How can you apply a filter using in_() in SQLAlchemy for JSON data?