Just to preface, I've seen a dozen similar SO Q/As and they appear to be a bit different (different server, different parameters etc).
Basic problem
Here's my question, we're running a select statement from the web server against our exadata 11g instance. It's a fairly simple query (it's a count). When it executes from the web server it will often take an average 150 times longer than if we run the exact same query from toad against the exact same database instance. Every once in a while the query will run just as quickly from the web server.
Additional info
When it goes bad from the web server the execution plan is significantly different including a full table scan. We can flip over to toad and run the query and get 300ms response. Turn back to the web server and 45 second response (we're watching through the oracle performance tools, new relic).
We've also tried logging in as the web user's oracle account and the performance runs great with the correct execution plan. So I'd assumed it isn't something related to the user (but I'm not totally aware if there is something else I could look at here).
Additionally we've enabled/disabled parallel query and seen no difference, similarly in toad. We can't get it to break outside of the web server.
The web server itself is a iis, using a read committed transaction (which we simulated in toad, toad still executes normally).
The degree on the tables is normal (I mean, you'd expect it to suck from both the web server and toad if this was an issues).
I don't think it could be a driver thing (could it?) since the query is already on the database server and oracle decides the execution plan regardless of who sends it and it sits in the exadata node spinning on the full table scan.
So I guess my question is, where else could I look when I'm essentially getting two different execution plans for the same query, same parameters, same user, run at the same time (or alternating) using different clients?