Ask Your Question
0

Why does a query using JDBC against Postgres take an indefinite amount of time to run, while the same query executed through pgAdmin is completed in only one minute?

asked 2021-08-19 11:00:00 +0000

lalupa gravatar image

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
0

answered 2022-08-17 01:00:00 +0000

nofretete gravatar image

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:

  1. 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.

  2. 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.

  3. 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.

  4. 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.

  5. 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.

edit flag offensive delete link more

Your Answer

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

Add Answer


Question Tools

Stats

Asked: 2021-08-19 11:00:00 +0000

Seen: 8 times

Last updated: Aug 17 '22