My Oracle Support Banner

First Query Always Takes More Time Than Subsequent Queries Executed Within The Same Connection in JDBC (Doc ID 1333080.1)

Last updated on AUGUST 30, 2023

Applies to:

JDBC - Version 11.1.0.7 and later
Information in this document applies to any platform.

Goal

When queries are executed within the same connection in JDBC 10g or 11g, the first query independently of being complex or simple takes 300 ms to execute, and the second is faster.
The first query, no matter its complexity (even select 1 from dual), seems to incur an additional ~300ms penalty.
For example:

First run:

select 1 from dual; <-- slow
complex query <-- fast


Second run with different order of queries:

complex query <-- slow
select 1 from dual <-- fast

Why is this behavior?


Solution

To view full details, sign in with your My Oracle Support account.

Don't have a My Oracle Support account? Click to get started!


In this Document
Goal
Solution


My Oracle Support provides customers with access to over a million knowledge articles and a vibrant support community of peers and Oracle experts.