Re: Some indexes not used in JDBC call



samuelrollins@xxxxxxxxx said:
I'm having a problem where a JDBC PreparedStatement without bind
parameters can take more than a minute to execute a query that takes
less than a second to execute in SQL*Plus. The query is identical, the
database instance is the same, neither query is cached, and the query
returns only 18 records with 11 columns all of which are either
VARCHAR2 or NUMBER. I'm using Oracle's JDBC 2.0 drivers
(classes12.jar) and Oracle 8i (Release 8.1.7.4.0) database. Oracle DB
is set to use the cost-based optimizer.

I did an explain plan in SQL*Plus and via JDBC. It turns out that some
of the unique indexes that are used when executing the query in
SQL*Plus are not used when executing via JDBC.

Does anyone know why this would happen?

It might be better if you took this to an Oracle-related group, or to
Oracle forums, but one guess, anyway.

With SQL*Plus I expect that you create a complete query with fixed values
whereas with JDBC you create the query with placeholders for values.
This affects Oracle optimizer somewhat, and can make Oracle leave out
any indexes regarding the fields compared with placeholders.
--
Wolf a.k.a. Juha Laiho Espoo, Finland
(GC 3.0) GIT d- s+: a C++ ULSH++++$ P++@ L+++ E- W+$@ N++ !K w !O !M V
PS(+) PE Y+ PGP(+) t- 5 !X R !tv b+ !DI D G e+ h---- r+++ y++++
"...cancel my subscription to the resurrection!" (Jim Morrison)
.



Relevant Pages

  • Re: monitorring number of records processed by AS
    ... execute an MDX query which return this measure and compare to the expected ... Have you take a look at the query executed by AS against your oracle ... Data source is ORACLE. ... Data provider is ORACLE PROVIDER for OLEDB. ...
    (microsoft.public.sqlserver.olap)
  • Re: Debug ORA-03113 on Oracle XE
    ... a laptop that runs the Oracle 10g Express ... The query returns no rows with the current data set but it's pretty ... If Oracle XE generates further info I don't know where I ... Usually, when you install Oracle, the UTL_FILE package is installed, EXECUTE is granted to PUBLIC, and a public synonym is created. ...
    (comp.databases.oracle.server)
  • Re: Finally which ORM tool?
    ... manipulate the linq query IF you're executing it at that moment. ... simply because the declaration construction was with 'CHOPS'. ... implement IEnumerablebut had an Execute() method which gave back ...
    (microsoft.public.dotnet.languages.csharp)
  • RE: SQL stored procedure executing twice
    ... I wasn't aware that DLookupwould execute the "domain" more than once. ... caused the stored procedure to execute twice. ... Dim stDocName As String ... My pass-thru query properties ...
    (microsoft.public.access.modulesdaovba)
  • Re: OO4O execute a query against Oracle, VBA Excel 2003
    ... I can execute the SQL with no problem using TOAD on Oracle ... 10G, but for some reason it won't using OO4O, every example that I ... Thanks, but I won't want to run the query in Toad/Or SQL*Plus, I ...
    (microsoft.public.excel.programming)