I have a database with Oracle 12c (12.1), where when making a query locally and even from TOAD or another remote tool, it returns the response in milliseconds, reviewing the execution plan I can see that it makes correct use of the indexes created, the problem is when I run the same query (same query, same tables ... everything exactly the same) but from my application server, where I have installed an oracle instantclient and instantclient-sqlplus (12.1), it turns out that if I launch The query from there (web server), takes a long time and when I check the execution plan I can see that it does not use any of the indexes unlike the executions from other positions different from the web, evidently there is the delay when not using the indexes, I would like to know why this can happen and how I could solve it, both servers (web and database) are on the same network segment, there is no connectivity element such as a firewall or any other type of routing involved, changing the query is not an option. Thank you.


1 Answer 1


Simplest solution: the queries are actually not the same.

Not so obvious solution: the sessions from the application server use different optimizer or NLS parameters and this affects the optimizer in a way it choses another execution plan due to different features enabled, different estimated query cost, NLS specific indexes. You can find some of these parameters used in views such as V$SES_OPTIMIZER_ENV, V$SQL_OPTIMIZER_ENV. Most NLS parameters are not included there, for that you need to check within the session or make the session store/display them somewhere.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.