Some indexes not used in JDBC call

Hello everyone,
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?
Thanks,
Jeff

since you use a bind variable,oracle's cost based
optimizer can not decide correctly whether to use
this index is a good idea.The OP said he was NOT using bind variables in the testing within the SQL String of the PreparedStatement so this comment doesn't address his current problem.
To the OP:
Sounds like you have an Oracle permissions issue not related to JDBC specifically. Shouldn't be to hard to determine what the permission differences are between the two userids.
Regarding proper use of PreparedStatement
ALWAYS use PreparedStatement and host variables. There are 100's if not 1000's of posts documentation why this is a good idea here on the forums. Here are a couple of reasons why PreparedStatement with Host variables is a good idea.
1) PreparedStatement using host variables will provide you best overall system performance.
2) PreparedStatement using host variables eliminates the very real security risk of SQL injection.
3) PreparedStatement using host variables aids the programmer in handling escape sequence and the frequent errors associated with special characters within SQL strings.
4) PreparedStatement using host variables allows JDBC to take care of the majority of data conversions between Java and your database simplifying and standardizing data conversion coding
There are isolated cases where using Host variables impedes performance when compared against dynamic SQL (SQL with literals) but they are few and far between (1: 1000?) and the standard should be to always use PreparedStatement with host variables.
Good luck on resolving your current problem and remember to always use PreparedStatements WITH host variables when coding in Java!
WFF

Similar Messages

  • URGENT: index not used from jdbc

    Hi,
    This is for java app and sybase database.
    I have a 'select' query for which index is properly created. If I use plain jdbc connection, index is used and result comes pretty fast. but if I use connection from my app, it does not use index and takes long time.
    I am using PreparedStatement in both cases. I have compared all connection properties for both cases and they are exactly same. also, if I run that query using any sql tool like isql, result comes out pretty fast.
    Am I missing any other parameter related to connection?

    akshay_crest wrote:
    I have a 'select' query for which index is properly created. If I use plain jdbc connection, index is used and result comes pretty fast. but if I use connection from my app, it does not use index and takes long time."Plain" meaning like a little test application that runs the same query?
    Most likely reasons.
    1. If the answer to the above is yes, then you probably are not running the same query.
    2. You are not timing them in the same way and something else is slowing it down.
    3. Network problem.
    4. Not connecting to the same database/table.

  • Indexes not used in Oracle 8i

    Hi Everybody,
    Does anybody know how can i know which indexes are not used in our Oracle 8iR3 Database.
    We need to purge as soon as possible all indexes not used
    in our Datawarehousing system because they're growing and growing.
    I know there's some mechanism in Oracle 9i to query which are unused is it possible to simulate something similar?
    Kind regards and thank you in advance.
    José Luis Pérez
    [email protected]

    Are you asking about index monitoring in 8i? One way (and there aren't very many at all) of doing this is to collect (query them out of the DD) execution plans and scan those for index usage.

  • In Siri, I can call by my voice, but why I can not use Siri voice call in my country (Laos), just can call only us phone number; my country we use like 3 number for option call, 8 numbers for call friend but Siri cannot use this please help us, thanks

    In Siri, I can call by my voice, but why I can not use Siri voice call in my country (Laos), just can call only us phone number; my country we use like 3 number for option call, 8 numbers for call friend but Siri cannot use this please help us, thanks
    And please help me can type Laos font in it like andrio phone.

    Hi Cozumel,
    Thanks for posting. I'm sorry you're having problems with your bills. I can take a look at this for you. Drop me an email with your account details and a link to this thread for reference. You'll find the address in my profile.
    Cheers
    David
    BTCare Community Mod
    If we have asked you to email us with your details, please make sure you are logged in to the forum, otherwise you will not be able to see our ‘Contact Us’ link within our profiles.
    We are sorry but we are unable to deal with service/account queries via the private message(PM) function so please don't PM your account info, we need to deal with this via our email account :-)

  • Some Clients not using Local Distribution Point

    I have a new physcial site that we are wanting to put the SCCM client on the workstations. The local DP has been setup and the SCCM 2012 config settings for the new site have been made. I did a manual push to 5 workstations and monitored the ccmsetup.log.
    I had some clients using the local DP for the client install and some went back across the WAN to the MP to get the files. The ones that come back across the WAN to the MP have this in their log shown below. It does not appear to be boundary related or
    Client OS as they are in the same subnet that is configured and have both xp and win7 working and not working. I found a few others have had this issue come up searching the web, but none of solutions helped in my situation. The client is installing on
    all of the workstations I have manually pushed it to. I just can't figure out why some are not using the local DP and YES I have verified that the ones not using the local DP are in the same boundary group as the ones that do. 
    Any help is appreciated. FVH081-DP1 is the local DP and AHDC400 is my MP
    Only one MP AHDC400.phs-sfalls.amck.net is specified. Use it. ccmsetup 1/23/2015 2:56:41 PM 2728 (0x0AA8)
    Searching for DP locations from MP(s)... ccmsetup 1/23/2015 2:56:41 PM 2728 (0x0AA8)
    Current AD site of machine is FVH LocationServices 1/23/2015 2:56:41 PM 2728 (0x0AA8)
    Local Machine is joined to an AD domain LocationServices 1/23/2015 2:56:41 PM 2728 (0x0AA8)
    Current AD forest name is amck.net, domain name is fvh.amck.net LocationServices 1/23/2015 2:56:42 PM 2728 (0x0AA8)
    DhcpGetOriginalSubnetMask entry point not supported. LocationServices 1/23/2015 2:56:42 PM 2728 (0x0AA8)
    Begin checking Alternate Network Configuration LocationServices 1/23/2015 2:56:42 PM 2728 (0x0AA8)
    Finished checking Alternate Network Configuration LocationServices 1/23/2015 2:56:42 PM 2728 (0x0AA8)
    Adapter {AB6BAB2C-7B65-441A-A83C-C91FF8B8498D} is DHCP enabled. Checking quarantine status. LocationServices 1/23/2015 2:56:42 PM 2728 (0x0AA8)
    Sending message body '<ContentLocationRequest SchemaVersion="1.00">
      <AssignedSite SiteCode="MCK"/>
      <ClientPackage/>
      <ClientLocationInfo LocationType="SMSPACKAGE" DistributeOnDemand="0" UseProtected="0" AllowCaching="0" BranchDPFlags="0" AllowHTTP="1" AllowSMB="0" AllowMulticast="0"
    UseInternetDP="0">
        <ADSite Name="FVH"/>
        <Forest Name="amck.net"/>
        <Domain Name="fvh.amck.net"/>
        <IPAddresses>
    <IPAddress SubnetAddress="10.7.64.0" Address="10.7.79.3"/>
        </IPAddresses>
      </ClientLocationInfo>
    </ContentLocationRequest>
    ' ccmsetup 1/23/2015 2:56:42 PM 2728 (0x0AA8)
    Sending message header '<Msg SchemaVersion="1.1"><ID>{DA5C91BE-3A3E-4E14-AF6E-DB0E9AC36878}</ID><SourceHost>FVHH008</SourceHost><TargetAddress>mp:[http]MP_LocationManager</TargetAddress><ReplyTo>direct:FVHH008:LS_ReplyLocations</ReplyTo><Priority>3</Priority><Timeout>600</Timeout><ReqVersion>5931</ReqVersion><TargetHost>AHDC400.phs-sfalls.amck.net</TargetHost><TargetEndpoint>MP_LocationManager</TargetEndpoint><ReplyMode>Sync</ReplyMode><Protocol>http</Protocol><SentTime>2015-01-23T20:56:42Z</SentTime><Body
    Type="ByteRange" Offset="0" Length="1068"/><Hooks><Hook3 Name="zlib-compress"/></Hooks><Payload Type="inline"/></Msg>' ccmsetup 1/23/2015 2:56:42 PM 2728 (0x0AA8)
    CCM_POST 'HTTP://AHDC400.phs-sfalls.amck.net/ccm_system/request' ccmsetup 1/23/2015 2:56:42 PM 2728 (0x0AA8)
    Content boundary is '--aAbBcCdDv1234567890VxXyYzZ' ccmsetup 1/23/2015 2:56:42 PM 2728 (0x0AA8)
    Received header '<Msg SchemaVersion="1.1">
     <ID>{45121E9D-C6EE-4154-BF60-AADD6204B66E}</ID>
     <SourceID>GUID:1B6F821D-DF54-4E9D-89BD-D68DD917DBD2</SourceID>
     <SourceHost>AHDC400</SourceHost>
     <TargetAddress>direct:FVHH008:LS_ReplyLocations</TargetAddress>
     <ReplyTo>MP_LocationManager</ReplyTo>
     <CorrelationID>{00000000-0000-0000-0000-000000000000}</CorrelationID>
     <Priority>3</Priority>
     <Timeout>600</Timeout>
     <TargetHost>FVHH008</TargetHost><TargetEndpoint>LS_ReplyLocations</TargetEndpoint><ReplyMode>Sync</ReplyMode><Protocol>http</Protocol><SentTime>2015-01-23T20:56:42Z</SentTime><Body Type="ByteRange"
    Offset="0" Length="2590"/><Hooks><Hook3 Name="zlib-compress"/><Hook Name="authenticate"><Property Name="Signature">3082018F06092A864886F70D010702A08201803082017C020101310B300906052B0E03021A0500300B06092A864886F70D0107013182015B30820157020101303430203110300E0603550403130741484443343030310C300A06035504031303534D53021058042BA685CEB3A74AC16009523D655A300906052B0E03021A0500300D06092A864886F70D0101010500048201002E2019E353A4244A8CA9D2451A6206393F00541279E76F3EFEED3C768C36F01EB88834E74E53D3063FC56D5A899C604036B8DCBACC765156270E5417D0A384440A2B29B08487F9BCEB84C3642D736587692675CBFB78DAF8017D94C5782E5166868F7B0B01E006319B1BDF6FA37DE9AFE5389C5CADF3A72572B08D01D68EE369C9830F4952B6C1B38F710B87888C65C27EB8176B8064BC392DB06C966112F119AD62E53C7B79EC26CEA9CFE027D401E535EAB166E18A5F37CB806EC21AF66510A41B5B4936953682DAF157EA50E02D51DF8A78DE4E12A368AE7693EEC37ACFAAC16ACF4C5DA0838F5821413C79A478DBAF1DCDAE23F6734C1D70882D3CBF4433</Property><Property
    Name="AuthSenderMachine">AHDC400;AHDC400.phs-sfalls.amck.net;</Property><Property Name="MPSiteCode">MCK</Property></Hook></Hooks><Payload Type="inline"/></Msg>' ccmsetup 1/23/2015
    2:56:42 PM 2728 (0x0AA8)
    Received reply body '<ContentLocationReply SchemaVersion="1.00"><ContentInfo PackageFlags="16777216"><ContentHashValues/></ContentInfo><Sites><Site><MPSite SiteCode="MCK" MasterSiteCode="MCK"
    SiteLocality="LOCAL" IISPreferedPort="80" IISSSLPreferedPort="443"/><LocationRecords><LocationRecord><URL Name="http://FVH081-DP1.phs-sfalls.amck.net/SMS_DP_SMSPKG$/AHS00002" Signature="http://FVH081-DP1.phs-sfalls.amck.net/SMS_DP_SMSSIG$/AHS00002"/><ADSite
    Name="FVH"/><IPSubnets><IPSubnet Address="10.7.64.0"/><IPSubnet Address=""/></IPSubnets><Metric Value=""/><Version>7804</Version><Capabilities SchemaVersion="1.0"><Property
    Name="SSLState" Value="0"/></Capabilities><ServerRemoteName>FVH081-DP1.phs-sfalls.amck.net</ServerRemoteName><DPType>SERVER</DPType><Windows Trust="1"/><Locality>LOCAL</Locality></LocationRecord></LocationRecords></Site><Site><MPSite
    SiteCode="MCK" MasterSiteCode="MCK" SiteLocality="LOCAL"/><LocationRecords/></Site></Sites><ClientPackage FullPackageID="AHS00002" FullPackageVersion="1" FullPackageHash="5EF3A189C48F3469440A83026EC8ECD36EAD6EAF3B5D35663F8201BDE175413C"
    MinimumClientVersion="5.00.7804.1000" RandomizeMaxDays="7" ProgramEnabled="false" LastModifiedTime="30282566;3841038464" SiteVersionMatch="true" SiteVersion="5.00.7804.1000" EnablePeerCache="true"/></ContentLocationReply>' ccmsetup 1/23/2015
    2:56:42 PM 2728 (0x0AA8)
    Found local location 'http://FVH081-DP1.phs-sfalls.amck.net/SMS_DP_SMSPKG$/AHS00002' ccmsetup 1/23/2015 2:56:42 PM 2728 (0x0AA8)
    Discovered 1 local DP locations. ccmsetup 1/23/2015 2:56:42 PM 2728 (0x0AA8)
    PROPFIND 'http://FVH081-DP1.phs-sfalls.amck.net/SMS_DP_SMSPKG$/AHS00002' ccmsetup 1/23/2015 2:56:42 PM 2728 (0x0AA8)
    Got 401 challenge Retrying with Windows Auth... ccmsetup 1/23/2015 2:56:42 PM 2728 (0x0AA8)
    PROPFIND 'http://FVH081-DP1.phs-sfalls.amck.net/SMS_DP_SMSPKG$/AHS00002' ccmsetup 1/23/2015 2:56:42 PM 2728 (0x0AA8)
    Failed to correctly receive a WEBDAV HTTP request.. (StatusCode at WinHttpQueryHeaders: 401) ccmsetup 1/23/2015 2:56:42 PM 2728 (0x0AA8)
    Failed to check url http://FVH081-DP1.phs-sfalls.amck.net/SMS_DP_SMSPKG$/AHS00002. Error 0x80004005 ccmsetup 1/23/2015 2:56:42 PM 2728 (0x0AA8)
    Enumerated all 1 local DP locations but none of them is good. Fallback to MP. ccmsetup 1/23/2015 2:56:42 PM 2728 (0x0AA8)
    GET 'HTTP://AHDC400.phs-sfalls.amck.net/CCM_Client/ccmsetup.cab' ccmsetup 1/23/2015 2:56:42 PM 2728 (0x0AA8)
    C:\WINDOWS\ccmsetup\ccmsetup.cab is Microsoft trusted. ccmsetup 1/23/2015 2:56:43 PM 2728 (0x0AA8)

    Single forest with mutiple child domains. SCCM is in one child domain trying to get this other child domain's workstations as clients. We have the same setup for another child domain and it worked without any issues.
    The IIS log file in C:\inetpub\logs\logfiles\w3svc1 only shows the successful installs. There are no entries about any failures in the log to correlate unfortunately. All failures have been XP SP3 machines except for one Win7 pc and all successes have been
    Win7 except for one xp machine.
    You wouldn't think it is network related because some workstations can access the DP fine.
    It's not boundaries because the successes and failures are all sharing the same subnet that is configured.
    Wasn't MSI 4.5 required for SCCM 2012 clients?

  • Can a Stored Procedure be called from a Rule (not using Scripted JDBC Adap)

    Hello smart people,
    Question: Can a stored procedure be called from a Rule without using the Scripted JDBC Resource Adapter?
    What's Desired: The project has very strong sql developers and average at best Java developers. We have been successful at implementing the scripted JDBC Resource Adapter which makes use of Java Bean shells. The custom Java Bean shell contains code that calls a stored procedure. We are cool with that process.
    However we would like to be able to set up a Rule that calls a Stored Procedure without jumping thru the Java Bean Shell layer. The Stored Procedures we will be developing will not access the tables in the Waveset database. Instead the Stored Procedures will be accessing custom tables in a custom database. The custom DBase will be housed on the same dBase server as the Waveset database.
    Environment: Identity Manager 7.1. Oracle 10i, and Unix OS.
    It seems to me that this task is possible, but the posts in this forum make it sound like perhaps it is not.
    Do any of you smart people agree that it should be possible or better yet has anyone implemented such an approach?
    Thanks.

    We did this by putting all of the JDBC calls into a Java class, then instantiated that class and called the methods from within a rule. An example of a rule we used is this:
    <Rule authType='UserMembersRule' name='List UserType'>
      <block>
        <defvar name='adapter'>
          <new class='com.waveset.adapter.ScriptedJdbcResourceAdapter'/>
        </defvar>
        <invoke name='setResource'>
          <ref>adapter</ref>
          <invoke name='getObject' class='com.waveset.ui.FormUtil'>
            <ref>context</ref>
            <s>Resource</s>
            <s>Banner</s>
          </invoke>
        </invoke>
        <defvar name='jdbcHelper'>
          <new class='edu.bates.JDBCHelper'>
            <invoke name='getConnection'>
              <ref>adapter</ref>
            </invoke>
          </new>
        </defvar>
        <defvar name='userList'>
          <new class='java.util.ArrayList'/>
        </defvar>
        <invoke name='addQueryToList'>
          <ref>jdbcHelper</ref>
          <s>SQL QUERY HERE</s>
          <ref>userList</ref>
        </invoke>
        <ref>userList</ref>
      </block>
      <MemberObjectGroups>
        <ObjectRef type='ObjectGroup' id='#ID#Top' name='Top'/>
      </MemberObjectGroups>
    </Rule>

  • Index not used in a simple query

    Hi all,
    I have a query which is using only 2 tables linked with an indexed column, i'm surprised that the 2 tables are not using index and they are full scanned. here is some details:
    Table a: T1 (col11 number, col12 varchar2) indexed on col11 (primary key): rows number=4 millions indexe: idx1 on col11
    Table b: T2 (col21 number, col22 varchar2) indexed on col21 (primary key): rows number=3 millions indexe: idx2 on col21
    select a.col12, b.col22 from T1 a, T2 b where a.col11=b.col21
    The execution plan is:
    Operation     Object Name     Rows     Bytes     Cost     Object Node     In/Out     PStart     PStop
    SELECT STATEMENT Optimizer Mode=ALL_ROWS          3 M           32356                                          
      PX COORDINATOR                                                                
        PX SEND QC (RANDOM)     SYS.:TQ10002     3 M     67 M     32356       :Q1002      P->S       QC (RANDOM)      
          HASH JOIN          3 M     67 M     32356       :Q1002      PCWP                        
            PX RECEIVE          3 M     20 M     7376       :Q1002      PCWP                        
              PX SEND HASH     SYS.:TQ10001     3 M     20 M     7376       :Q1001      P->P       HASH             
                PX BLOCK ITERATOR          3 M     20 M     7376       :Q1001      PCWC                        
                  TABLE ACCESS FULL     T2     3 M     20 M     7376       :Q1001      PCWP                        
            BUFFER SORT                             :Q1002      PCWC                        
              PX RECEIVE          3 M     44 M     24708       :Q1002      PCWP                        
                PX SEND HASH     SYS.:TQ10000     3 M     44 M     24708              S->P       HASH             
                  TABLE ACCESS FULL     T1     3 M     44 M     24708                                           Thanks

    Hi Herald,
    Thanks for your reply
    when selecting only the columns which are indexed, it is using the index
    select a.account_link_code_n, b.account_link_code_n from gsm_sims_master a, gsm_service_mast b
    where a.account_link_code_n=b.account_link_code_n
    See the execution below:
    Operation     Object Name     Rows     Bytes     Cost     Object Node     In/Out     PStart     PStop
    SELECT STATEMENT Optimizer Mode=ALL_ROWS          3 M           11051                                          
      PX COORDINATOR                                                                
        PX SEND QC (RANDOM)     SYS.:TQ10002     3 M     44 M     11051       :Q1002      P->S       QC (RANDOM)      
          HASH JOIN          3 M     44 M     11051       :Q1002      PCWP                        
            PX RECEIVE          3 M     20 M     7376       :Q1002      PCWP                        
              PX SEND HASH     SYS.:TQ10001     3 M     20 M     7376       :Q1001      P->P       HASH             
                PX BLOCK ITERATOR          3 M     20 M     7376       :Q1001      PCWC                        
                  TABLE ACCESS FULL     GSM_SERVICE_MAST     3 M     20 M     7376       :Q1001      PCWP                        
            BUFFER SORT                             :Q1002      PCWC                        
              PX RECEIVE          3 M     22 M     3403       :Q1002      PCWP                        
                PX SEND HASH     SYS.:TQ10000     3 M     22 M     3403              S->P       HASH             
                  INDEX FAST FULL SCAN     ABILLITY.SIM_ACC_LNK_CD_IDX     3 M     22 M     3403                                                     But using hints has a very bad execution plan and a very high cost:
    select /*+ index(a) index(b) */ a.account_link_code_n, b.account_link_code_n from gsm_sims_master a, gsm_service_mast b
    where a.account_link_code_n=b.account_link_code_n
    Operation     Object Name     Rows     Bytes     Cost     Object Node     In/Out     PStart     PStop
    SELECT STATEMENT Optimizer Mode=ALL_ROWS          3 M           31899                                          
      HASH JOIN          3 M     44 M     31899                                          
        INDEX FULL SCAN     ABILLITY.GSM_SERV_MAST#ACLINK_CODE$PK     3 M     20 M     8158                                          
        INDEX FULL SCAN     ABILLITY.SIM_ACC_LNK_CD_IDX     3 M     22 M     15709                                           Thank you
    Luc

  • Index not used on view when table stats exist

    Hello,
    I would be grateful if someone comes with ideas on the following problem I'm currently facing.
    I have a table with XMLTYPE data type column:
    sql-->desc ACFBNK_STMT008
    RECID     NOT NULL     VARCHAR2(200)
    XMLRECORD XMLTYPE
    I have a view V_ACFBNK_STMT008 on that table, in which the view columns are defined as extracted tags values from the XMLTYPE field, e.g. for the view field N_BOOKING_DATE:
    numcast(extractValue(xmlrecord,'/row/c25')) "N_BOOKING_DATE"
    (note: numcast is just a simple function that returns TO_NUMBER of its input argument)
    I have also a function-based index on this field of the table:
    CREATE INDEX train4.NIX_ACFBNK_STMT008_C25
    ON train4.ACFBNK_STMT008("TRAIN4"."NUMCAST"(extractValue(xmlrecord,'/row/c25')))
    And so, I'm executing on the view the following SQL statement:
    SELECT RECID FROM V_ACFBNK_STMT008 WHERE (N_BOOKING_DATE > TO_NUMBER('20070725'));
    Now, the problem comes: when statistics exist on the view base table (that is ACFBNK_STMT008) then the above statement is not using the index and is making a "table access full". When I delete the statistics for the table then the SQL runs fast with an "index range scan".
    Which is further strange - when I change the ">" operand with a "=" the SQL statement correctly captures the index regardless of whether or not statistics exist.
    I've tried to manually rewrite the SQL and include the "numcast" function in it:
    SELECT RECID FROM TRAIN4.V_ACFBNK_STMT008 WHERE ( N_BOOKING_DATE>train4.numcast(TO_NUMBER( '20010725' ) ));
    And in this way the index is used OK even with statistics existing!
    But regretfully I don't have a way to change the application and the SQL, so the only things I can change is the view and/or the index.
    Thank you in advance,
    Evgeni
    P.S.
    I've tried gathering statistics in both the following ways but still the problem persists:
    sql-->analyze table train4.ACFBNK_STMT008 compute statistics;
    sql-->exec dbms_stats.gather_table_stats(ownname=>'TRAIN4', tabname=>'ACFBNK_STMT008', CASCADE=>TRUE, partname=>NULL);

    Oh, and I forgot to mention: I cannot change the view definition as well (for example, to remove the "numcast"), since every now and then the application would recreate it automatically with the same code. :(

  • Index not using in select query

    Hello All,
    I have table CITY with 2 composite primary key CITYCODE, COUNTRYCODE of course they are NOT NULL.
    i created an index.
    CREATE UNIQUE INDEX CITYKEY ON CITY     (CITYCODE, COUNTRYCODE);
    then i run explain plan as follows
    explain plan for
    select CityCode, CityName, CountryCode, LexiconId, UserId, Status
    from City
    where CountryCode = 'IR';
    | Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Time |
    | 0 | SELECT STATEMENT | | 803 | 57013 | 112 (2)| 00:00:02 |
    |* 1 | TABLE ACCESS FULL| CITY | 803 | 57013 | 112 (2)| 00:00:02 |
    later i analyze table rebuild indexes but again explain plan gives me the same result.
    Could any 1 please guide me to solve this issue.
    Thanks
    Edited by: mohsin javed on Feb 17, 2011 10:10 AM

    Hello All,
    Again with one more query which having join:
    table SDNMASTER with sdnid pk and SDNMASTER_PK index on SDNID, table SDNALIAS sdnid pk and SDNALIAS_PK index on SDNID.
    explain plan for
    SELECT a.SourceId,
              a.SourceName,
              b.LastName,
              a.Status
    FROM SdnMaster a,
              SdnAlias b
    WHERE a.SdnId = b.SdnId
    AND a.Status in ('1', '3')
    AND b.LastName is not null
    ORDER BY b.LastName;
    PLAN_TABLE_OUTPUT
    Plan hash value: 1153036645
    | Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Time |
    | 0 | SELECT STATEMENT | | 2399 | 64773 | 69 (5)| 00:00:01 |
    | 1 | SORT ORDER BY | | 2399 | 64773 | 69 (5)| 00:00:01 |
    |* 2 | HASH JOIN | | 2399 | 64773 | 68 (3)| 00:00:01 |
    |* 3 | TABLE ACCESS FULL| SDNALIAS | 2399 | 21591 | 11 (0)| 00:00:01 |
    |* 4 | TABLE ACCESS FULL| SDNMASTER | 4562 | 82116 | 56 (2)| 00:00:01 |
    Even after analyzing table and rebuilding index its not using the index..
    Thanks

  • Index not used

    Hello all,
    I have a large table (20 million rows) partitioned by date (2 million rows/part) that includes an hour column. The hour data is stored in the '99' format as we only have 24 values/day. However the client wants the data displayed as '9999' so we created a set of views that display the data as hour||'00'. Our base table unique index includes the hour column, but now all the queries are seen by the database as where hour ='1100' as oposed to where hour='11' and the index is not used any more. How can we tell the optimizer that the '1100' that the client is selecting through the web views is actually our '11' that is stored in the already existing index?
    Please note that I would like to avoid having to create a function index. The existing index already takes 1.3Gb, don't wnt to spend another 1.3 Gb.
    Thank you very much,

    Your description doesn't quite compute.
    Access to rows in the WHERE clause has no relationship to what is displayed from the SELECT clause of a view. You may want to post the DDL and DML to explain how this is happening.

  • How to find BW Indexes not used in a long time

    Hello all,
    I am attempting to find out which indexes have not been used in the last 2 years in a effort to eliminate indexes from our BWA environment.  Is there a way I can query our BW environment to figure this out?  Is there a table, or group of tables in combination, that might be able to help me out here?
    Thanks to you all.

    Thanks for such a quick response.
    I am assuming the following about the table :
    -     Column u201CCALDAYu201D contains a date value for each day the Index is active.
    -     Column u201CBIA_USEDu201D contains a value that is iterated for the given day each time the Index is used.
    -     Column u201CBIA_NOTPOSSIBLEu201D contains a value representing how many times a query could not access this Index.
    -     Column u201CNO_BIAu201D tells if a BWA Index exists at all on any of my BWA Blades
    -     Column u201CBIA_TECHINAu201D ????????
    -     Column u201CBIA_INAu201D ???????
    -     Column u201CDB_FALLBACKu201D ???????
    I am not sure if my understanding of the column is correct.  Can you tell me they are?  The columns with u201C???????u201D mean I have no solid understanding of how to use these columns at all.
    Thanks

  • Bitmap Index Not Used in PROD and used in DEV

    I am in a situation where in in DEV Bitmap Index is used and in PROD bitmap Index is not used. I checked the count, in PROD I have 10 mil rows and in DEV I have 16 mil rows. Optimizer is CHOOSE and also when I tried to force to use index in PROD, I got higher cost.
    Any suggestions why Index is not used in PROD as opposed to DEV

    As other says, no guarantee that the same query with same setting OS, ORACLE to produce the same execution plan. Also, as Justin said, dont every take cost as your tuning parameter, pay attention to response time, also, number of logical reads and physical reads. What are the wait events during?
    For an index, most important factors are, blevel, clustering_factor, number of distinct values. Clustering actor make a lot of difference. You said, when you force index to use, your performance has gained. If so, why not, why the HINTS there in place? Go ahed and use it, but, after all the R&D. Are the Optimizer* paraemters same on the both databases?
    If possible, post the execution plan of the query, with HINT and without HINT as well.
    Jaffar

  • Bitmap index not used

    I exported/imported a schema. Same Oracle version (10.2.0.3), same server (HP-UX/Itanium).
    I have a select that doesn't use a bitmap index in the new database. The same bitmap index is used in the old database.
    I run analyze, tried hinting (index, index_combine) nothing helped, I could not force the optimizer to use the index in the new database. Any suggestion?
    Thanks

    Hi Andras
    I would strongly recommend taking a 10053 trace and see what the CBO is up to.
    Cheers
    Richard Foote
    http://richardfoote.wordpress.com/

  • Index not used - why?

    Hi,
    I build a SQL-Report with this Statement:
    SELECT wb_mitarbeiter, wb_datum, wb_zeit, wb_kennzeichen, wb_ziel,
    sb_mitarbeiter, sb_datum, sb_zeit, sb_kennzeichen, sb_ziel,
    DECODE (wb_kennzeichen - sb_kennzeichen, 0, '', 'Diff') flag
    FROM lgs_items_org
    WHERE (sb_datum >= :p14_von OR -1 = :p14_von)
    AND (sb_datum <= :p14_bis OR -1 = :p14_bis)
    AND sb_mitarbeiter > 0
    AND (wb_mitarbeiter = :p14_wb_ma OR -1 = :p14_wb_ma)
    ORDER BY wb_datum ASC, wb_zeit ASC
    The result is correct, but a full table scan is performed, no index is used and needs very much time.
    In SQL*Plus I run this statement (:P14_von + :P14_bis replaced):
    SELECT wb_mitarbeiter, wb_datum, wb_zeit, wb_kennzeichen, wb_ziel,
    sb_mitarbeiter, sb_datum, sb_zeit, sb_kennzeichen, sb_ziel,
    DECODE (wb_kennzeichen - sb_kennzeichen, 0, '', 'Diff') flag
    FROM lgs_items_org
    WHERE sb_mitarbeiter > 0
    AND (sb_datum >= '20051122' OR -1 = '20051122')
    AND (sb_datum <= '20051122' OR -1 = '20051122')
    AND (wb_mitarbeiter = :p14_wb_ma OR -1 = :p14_wb_ma)
    ORDER BY wb_datum ASC, wb_zeit ASC
    Here an index is used. The result is correct and very fast.
    1) Why is the index?
    and
    2) How can I change the statement, to use the index?
    Thanks for any idea!
    Regards,
    Frank

    Thanks for your help! Thanks for the book-tip!
    I got it. The problem is the where-part.
    and (wb_mitarbeiter = :Pxy OR -1 = :Pxy) does NOT use an index, because the 2.part of the OR does not use an indexed column.
    But and wb_mitarbeiter = :Pxy (without the OR part) uses the index.
    My solution: I changed the sql-structured Query into a PL/SQL-Function-Body Report (a little bit longer :-( )
    declare
    q varchar2(5000);
    begin
    q := 'select NAME||'' - '' ||WB_MITARBEITER WB_MITARBEITER';
    q := q||', to_char(to_date(WB_DATUM,''YYYYMMDD''),''DD.MM.YYYY'') "DATUM WB"';
    q := q||', WB_ZEIT, WB_KENNZEICHEN WB_KZ, WB_ZIEL';
    q := q||', SB_MITARBEITER';
    q := q||', to_char(to_date(SB_DATUM,''YYYYMMDD''),''DD.MM.YYYY'') "DATUM SB"';
    q := q||', SB_ZEIT, SB_KENNZEICHEN SB_KZ, SB_ZIEL';
    q := q||', DECODE(WB_KENNZEICHEN - SB_KENNZEICHEN,0,'''',''Diff'') Flag';
    q := q||' from wwcontrol.LGS_ITEMS_ORG, wwcontrol.LGS_PERSONAL_ORG';
    q := q||' where SB_MITARBEITER > 0 AND WB_MITARBEITER = PINNR';
    if :P14_VON <> -1 THEN
    q := q||' and SB_DATUM >= :P14_VON ';
    end if;
    if :P14_BIS <> -1 THEN
    q := q||' and SB_DATUM <= :P14_BIS ';
    end if;
    if :P14_WB_MA <> -1 THEN
    q := q||' and WB_MITARBEITER = :P14_WB_MA ';
    end if;
    if :P14_DIFF = 1 THEN
    q := q||' and WB_KENNZEICHEN - SB_KENNZEICHEN <> 0';
    end if;
    q := q||' order by WB_DATUM asc, WB_ZEIT asc';
    return q;
    end;
    Is there a way to do this smarter?
    Regards,
    Frank

  • Find Indexes not used

    Hi ,
    Is there any script that i can run to see all the indexes that are not used in the Entire batch Jobs (these batch job has many DML's on large number of tables) but present(in valid state) during the Run.
    The main idea is to have these indexes and see if we can drop these indexes(if there is not impact on other operations).
    Thanks for the time,
    Bob

    http://www.oracle-base.com/articles/10g/IndexMonitoring.php

Maybe you are looking for

  • How to navigate with the keyboard in album view?

    Hello Is there a better way to navigate through the albums and then select/control tracks within an "open" Album in Album-View without using the mouse than what I am trying to describe below? iTunes is idle. switch to album view (shortcut to switch v

  • Dataguard Issue

    Hello Everyone, I am facing a issue with Dataguard setup. Following is the description: Purpose: Setup a Dataguard using Oracle Data Guard Solution between Production & DR(Physical standby) databases. Problem Statement: In case the network connectivi

  • Macbook 1.1 trackpad/clicker disabled by beta 12 os 10.5.8

    simple--trackpad/clicker has gone wild. clicks when it shouldnt and does when it shouldnt. works fine with safari 5.0.6 i have deleted, highlighted, dragged, downloaded, and just plain screwed up to hell and back 50 times a day for untold weeks plus

  • Mail Not Remembering Window Position of Previous Session

    Mail has started forgetting how its main window was sized when previously using the application. When I open Mail, the window dimensions are like those for a small screen - not as previously sized. Is this a known problem (could not find with discuss

  • Naming png sequence with specific frame numbers from After Effects

    I am currently using Media Encoder 7.2.2.29 and After Effects version 12.2.1, and I am running it on Mac OSX 10.8.2 I am making an animated sequence in After Effects that after exporting I caught a few things I want to change throughout the piece.  I