SQL Performance (MOSC)

MOSC Banner

Performance Degradation in Oracle Paginated Query with Bind Variables via OJDBC

edited May 26, 2025 7:28AM in SQL Performance (MOSC) 4 commentsAnswered

I'm facing a performance issue with the following paginated query:

SELECT a.*

FROM (

SELECT task_desc,

task_id,

aircraft_sdesc,

inventory_desc,

soft_deadline,

is_estop,

'GetMxTask' luname

FROM ad_task_search_dm

) a

OFFSET 24 ROWS FETCH FIRST 25 ROWS ONLY;

When investigating the above performance issue, I found out that the query executes efficiently in tools like PL/SQL Developer, since it's using

string literals.

However, the same query takes significantly longer when using bind variables in the application.

And another thing is that the query is much faster without OFFSET value.

As a temporary workaround, I’ve considered applying query hints to force specific execution paths. However, I’m concerned that using hints generically may negatively impact other areas of the application.

Howdy, Stranger!

Log In

To view full details, sign in to My Oracle Support Community.

Register

Don't have a My Oracle Support Community account? Click here to get started.

Category Leaderboard

Top contributors this month

New to My Oracle Support Community? Visit our Welcome Center

MOSC Help Center