Do I need another index?

Hi!
I have a table:CREATE TABLE G5DZE (
    "ID"     VARCHAR2(100 BYTE),
    "STATUS" NUMBER(2,0) DEFAULT 1,
    "G5IDD"  VARCHAR2(200 BYTE),
    "G5IDR"  VARCHAR2(200 BYTE),
    "G5NOS"  VARCHAR2(200 BYTE),
    "G5WRT"  NUMBER(32,0),
    "G5DWR"  DATE,
    "G5PEW"  NUMBER,
    "G5DZP"  NUMBER(1,0),
    "G5RZN"  VARCHAR2(200 BYTE),
    "G5DWW"  DATE,
    "G5DTW"  DATE,
    "G5DTU"  DATE,
    "ID_G5JDR_RJDR" VARCHAR2(100 BYTE),
    "IDR"           VARCHAR2(100 BYTE),
    "PLS_ID"        NUMBER
  );and similar table with ROG_TEMP_G5DZE name. There are indexes:CREATE UNIQUE INDEX "G5DZE_PK" ON "G5DZE" ("PLS_ID", "ID");
CREATE UNIQUE INDEX "T_G5DZE_PK" ON "ROG_TEMP_G5DZE" ("PLS_ID", "ID");
CREATE INDEX "G5DZE_JDR_FK" ON "G5DZE" ("PLS_ID", "ID_G5JDR_RJDR");
CREATE INDEX "T_G5DZE_JDR_FK" ON "ROG_TEMP_G5DZE" ("PLS_ID", "ID_G5JDR_RJDR");PK is the pair (PLS_ID, ID).
Table G5DZE contains current data and ROG_TEMP_G5DZE contains previous data.
I need to find what records were added to G5DZE and what records were in ROG_TEMP_G5DZE but now they aren't in G5DZE.
SELECT null, null, null,
              g5.id    AS new_ID,
              g5.G5DTU AS new_DTU,
              g5.G5DTW AS new_DTW
         FROM G5DZE g5
        WHERE g5.STATUS = 1
          AND NOT EXISTS (SELECT 1
                            FROM ROG_TEMP_G5DZE
                           WHERE G5DTU = g5.G5DTU AND -- ***
                                 ID = g5.ID AND
                                 status=1
                             AND pls_id = 530)
        UNION ALL
       SELECT rt.id AS old_ID,
              rt.G5DTU AS old_DTU,
              rt.G5DTW AS old_DTW,
              null, null, null
         FROM ROG_TEMP_G5DZE rt
        WHERE rt.STATUS = 1
          AND pls_id = 530
          AND NOT EXISTS (SELECT 1
                            FROM G5DZE
                           WHERE G5DTU = rt.G5DTU AND
                                 rt.ID = ID
                             AND status=1);Now I have about 60k rows in both tables. The first SELECT (before the UNION ALL) first fast when I comment the WHERE condition marked with "***".
The explain plan for first SELECT is:PLAN_TABLE_OUTPUT
Plan hash value: 3325319594
| Id  | Operation                    | Name           | Rows  | Bytes | Cost (%CPU)| Time     |
|   0 | SELECT STATEMENT             |                |     1 |   170 |     2   (0)| 00:00:01 |
|   1 |  NESTED LOOPS ANTI           |                |     1 |   170 |     2   (0)| 00:00:01 |
|*  2 |   TABLE ACCESS FULL          | G5DZE          |     1 |    83 |     2   (0)| 00:00:01 |
|*  3 |   TABLE ACCESS BY INDEX ROWID| ROG_TEMP_G5DZE |     1 |    87 |     0   (0)| 00:00:01 |
|*  4 |    INDEX RANGE SCAN          | T_G5DZE_JDR_FK |     1 |       |     0   (0)| 00:00:01 |
Predicate Information (identified by operation id):
   2 - filter(G5.STATUS=1)
   3 - filter(STATUS=1 AND G5DTU=G5.G5DTU AND ID=G5.ID)
   4 - access(PLS_ID=530)and when I comment the marked WHERE condition:PLAN_TABLE_OUTPUT
Plan hash value: 1041062869
| Id  | Operation                     | Name           | Rows  | Bytes | Cost (%CPU)| Time     |
|   0 | SELECT STATEMENT              |                |     1 |   161 |     2  (50)| 00:00:01 |
|   1 |  MERGE JOIN ANTI              |                |     1 |   161 |     2  (50)| 00:00:01 |
|*  2 |   TABLE ACCESS BY INDEX ROWID | G5DZE          |     1 |    83 |     0   (0)| 00:00:01 |
|   3 |    INDEX FULL SCAN            | G5DZE_PK       |     1 |       |     0   (0)| 00:00:01 |
|*  4 |   SORT UNIQUE                 |                |     1 |    78 |     2  (50)| 00:00:01 |
|*  5 |    TABLE ACCESS BY INDEX ROWID| ROG_TEMP_G5DZE |     1 |    78 |     1   (0)| 00:00:01 |
|*  6 |     INDEX RANGE SCAN          | T_G5DZE_JDR_FK |     1 |       |     1   (0)| 00:00:01 |
Predicate Information (identified by operation id):
   2 - filter(G5.STATUS=1)
   4 - access(ID=G5.ID)
       filter(ID=G5.ID)
   5 - filter(STATUS=1)
   6 - access(PLS_ID=530)Do I need to create another index like:CREATE UNIQUE INDEX G5DZE_3I ON G5DZE (PLS_ID, ID, G5DTU);to make the query run faster or is there better sollution? The index would have rather redundant data.

Karthick_Arp wrote:
Did you try using MINUS operator?No, I didn't. I can't imagine how may the MINUS be used here. May I ask for an example?
When I add index:create index G5DZE_I4 on G5DZE (status, ID, g5dtu,g5dtw);the plan for statementSELECT null, null, null,
        g5.id    AS new_ID,
        g5.G5DTU AS new_DTU,
        g5.G5DTW AS new_DTW
   FROM G5DZE g5
  WHERE g5.STATUS = 1
    AND NOT EXISTS (SELECT 1
                      FROM ROG_TEMP_G5DZE
                     WHERE G5DTU = g5.G5DTU AND
                           ID = g5.ID AND
                           status=1
                       AND pls_id = 530);isPLAN_TABLE_OUTPUT
Plan hash value: 3290283461
| Id  | Operation                    | Name           | Rows  | Bytes | Cost (%CPU)| Time     |
|   0 | SELECT STATEMENT             |                |     1 |   170 |     1   (0)| 00:00:01 |
|   1 |  NESTED LOOPS ANTI           |                |     1 |   170 |     1   (0)| 00:00:01 |
|*  2 |   INDEX RANGE SCAN           | G5DZE_I4       |     1 |    83 |     1   (0)| 00:00:01 |
|*  3 |   TABLE ACCESS BY INDEX ROWID| ROG_TEMP_G5DZE |     1 |    87 |     0   (0)| 00:00:01 |
|*  4 |    INDEX RANGE SCAN          | T_G5DZE_JDR_FK |     1 |       |     0   (0)| 00:00:01 |
Predicate Information (identified by operation id):
   2 - access(G5.STATUS=1)
   3 - filter(STATUS=1 AND G5DTU=G5.G5DTU AND ID=G5.ID)
   4 - access(PLS_ID=530)but the query still runs VEEEERRRRY slow :(
Statistics are not gathered yet, however. I tried to do that but DBA need fix some datablocks first.

Similar Messages

  • Need to create another index ?

    Hi,
    Using Oracle 9.2 I have a table STATS and an index STATS_IDX on the following columns in the order : Objectid, Stat_Hour, Parent.
    I now want to optimize queries that filter or sort on Stat_Hour. Do i have to create another index having just Stat_Hour or will Oracle use the existing index to optimize my queries that filter or sort on Stat_Hour ?
    Thanks
    Christian

    Christian,
    Since stat_hour is not the leading column of STATS_IDX, you might want to create another index where stat_hour is the leading key in case you want the query to center around stat_hour column.
    Please post the query plans with and without indexes if you try the recommendation.
    Shakti
    http://www.impact-sol.com
    Developers of Guggi Oracle - Tool for DBAs and Developers

  • The folder is already attached to another index of the same type

    Hi,
    I deleted an index in the portal and want now to created a new index with the same datasource, I get the following errormessage:
    The folder is already attached to another index of the same type: datasourcename
    Does anybody have an idea?
    BR
    Steven

    Hi,
    make sure you really don't see the index in KM anymore.
    If this is the case you could try to delete the index with the TREX Admin Tool on the TREX host. Maybe first just have a look, if on the TREX side the index is still there. This would mean, that in KM the index was deleted but not on TREX.
    But you  should be sure what you do, when using the admin tool!
    Maybe you should also test, if this was just a temporary problem, or if it occurs always when you delete an index.
    Deleting an index should work fine from KM and using the admin tool should only be needed for this in rare cases.
    Regards,
    Sascha

  • I have a macbook pro, a mini display port to hdmi cable to hook up to my tv (a toshiba 1080p flatscreen).  what do I do to actually get the image on the tv screen?  Do I need another cable for sound?

    I am trying to watch a tv show that I purchased into I-tunes.  I have the cable and it hooks to the TV okay.  The TV shows the regular apple screen that looks like the universe screen - like when it boots up or is doing an upgrade on the OS.  I can't get the image to go from the laptop to the TV.  I tried under displays and it shows the TV as a display but I can't get the image on the TV.......Please help.

    Rwogera wrote:
    I couldn't transmit sound either, do i need another cable like Kim said? i mean it cant be transmitted through this HDMI port? as for me i have one of the latest mac pro with intel core i5..tnx
    I need to know which MacBook Pro you have.  Only mid-2010  and later MBP's transmit sound through MiniDisplay Port to HDMI.  I have no information about the Mac Pro, so you might want to go to that Forum and ask there.

  • HT4436 Why is my daughter receiving my text messages on her itouch when I send them from my iphone? We are both on icloud so how can I separate the two? Do I need another icould or apple account??

    Why is my daughter receiving my text messages on her itouch when I send them from my iphone? We are both on icloud so how can I separate the two? Do I need another icould or apple account??

    It's happening because you are using the same Apple ID for iMessage.  You don't need to do anything with your iCloud account to fix this.  You should create a separate Apple ID for her device to use with iMessage and FaceTime.  (You can continue to share the same ID for purchasing from the iTunes and App stores if you wish; it doesn't need to be the same as the ID you use for other services.)  Once you've done this, on her device go to Settings>Messages>Send & Receive, tap the ID, sign out, then sign back in with the new ID.  Do the same thing in Settings>FaceTime.
    Another caution is that if you share and iCloud account with her, any data you both sync with the account such as contacts, will be merged and the merged data will appear on both devices.  If you don't want to end up with each other's contacts, calendars, etc. on your devices, you should have separate iCloud accounts to.  If you want to make this change, go to Settings>iCloud on her device and tap Delete Account.  (This only deletes the account from the device, not from iCloud.)  When prompted about what to do with the iCloud data be sure to choose Keep On My iPod.  Then set up a new iCloud account with her new ID, turn on iCloud data syncing again, and when prompted choose Merge.

  • Hi all, I'm trying to download a film from iTunes onto my iPad but downloaded the HD version instead of SD and don't have the room to download it. Have removed everything I can to make space but still need another 1.2 GB. How can I delete it??

    Hi all, I'm trying to download a film from iTunes onto my iPad but downloaded the HD version instead of SD and don't have the room to download it. Have removed everything I can to make space but still need another 1.2 GB. Is there any way I can delete it so I can delete the version I wanted, or even better change to the SD version? The film is still queuing in the downloads list. I've tried edit and delete but that doesn't work. I also can't re-download the film from iTunes.
    Any suggestions very welcome!

    Try to connect in recovery mode, explained in this article:
    iOS: Unable to update or restore
    Before that, back up your device, explained here:
    iOS: Back up and restore your iOS device with iCloud or iTunes
    How to back up your data and set up as a new device
    You can check your warranty status here:
    https://selfsolve.apple.com/agreementWarrantyDynamic.do

  • How to run a jar file which needs another jar to be in the class path

    Hi,
    I need to execute a jar, which needs another jar to be in the classpath.
    If I run like
    java -classpath <jar1 name> -jar <main jar>
    It is giving classnotfoundexception, where as the class is available in the <jar1 name>.
    so, currently I am doing like this
    In the manifest file i have given like
    Main-Class: <class name>
    Class-Path: <jar name> <jar name2>
    then it is running fine. But, if I want to change the jar location again I need to changed the manifest file.
    Is there any way to do this? Pls help me.

    How about
    java -cp jar1.jar;jar2.jar com.acme.MainClass
    You won't need to worry about the manifest file after that and you can make a bat files (or .sh file in *nix) for it.                                                                                                                                                                                                                                                                                                                                                                       

  • I need to know the best, safest way to convert video for Mac.  I just had home movies converted to a DVD format a realize now that I need another step to burn them to my computer.

    I just had home movies converted to a DVD format a realize now that I need another step to burn them to my computer.  This is for a Christmas present!  Help.

    I don't think you need to use a ripper program to read a home movie DVD. Those are primarily for copy-protected commercial DVDs, right?
    I think you just need to transcode the DVD files using a utility like Handbrake, which is free and fast.
    http://handbrake.fr/details.php

  • I have a students excel package intalled on my Mac Book - can I also install this software on my new mac mini - do I need another license or can I populate two machines?

    I have a students excel package intalled on my Mac Book - can I also install this software on my new mac mini - do I need another license or can I populate two machines?

    Normally Microsft allows the installation of their programs, except Operating Systems, to be installed on a desktop and notebook at the same time as long as both system are used exclusively by the same person and Not at the same time.
    So this should also be true for MS Office for Mac. The only way to tell is to install it on the Mini and then use the same key to activate it. If the activation goes through you are fine. But if you run both system at the same time do not open any of the Office programs on both system at the same time. That may trigger MS to disallow one of the activations.
    MS Office for both Mac and Windows checks the local network and logs into the MS activation site everytime one of the apps is started to check current activation and to check if you have it running on more then one computer on your local network using the same key.

  • I have 4 computers running Adobe CC under two different accounts (as 1 account can only be installed on two computers) i need it on a 5th computer now, do i need another account or can i set up something so all 5 run from the same account making it easier

    I have 4 computers running Adobe CC under two different accounts (as 1 account can only be installed on two computers) i need it on a 5th computer now, do i need another account or can i set up something so all 5 run from the same account making it easier?

    Check into a Team account
    -http://www.adobe.com/products/creativecloud/teams/benefits.html
    -assign a new team member http://forums.adobe.com/thread/1460939?tstart=0 may help
    -Team Installer http://forums.adobe.com/thread/1363686?tstart=0

  • I have adobe export on my desk top at office but can't find on my laptop at home - can I use both places or do I need another subscription?

    I have adobe export on my desk top at office but can't get it to work on my laptop at home - can I use both places or do I need another subscription?

    Hi silverbird,
    Your subscription allows you to use ExportPDF from a supported web browser on any device--you don't need a separate subscription for separate devices. When you say you can't get it to work on your laptop--do you mean you're unable to log in? Do you get a particular error message? Please let me know what's happening on your laptop, and we will take it from there.
    Best,
    Sara

  • In anticipating upgrading to Premiere Elements 13, I need to know what "gotchas" there might be in loading project files from version 10 (in case someone needs another DVD/Blu-Ray)

    Particularly, can I load project files from version 10 (in case someone needs another DVD/Blu-Ray)

    cbjameson
    What computer operating system is involved?
    There is no guarantee that a project created in an earlier version can be opened in a later one. Many times it can, but...
    If you do try this, then please consider working from a copy of the project 10 project file and then trying to open that in 13/13.1.
    Reason: projects created in an earlier version and then opened and edited in a later version cannot be opened again in the
    earlier version.
    And, there is always the issue of maintaining the connect of the source media with the project file. Is this move from 10 to 13/13.1
    happening on the same computer and are the source media in the same place where they were when they were first imported
    into the 10 project. Disc menus consideration may enter into this depending on your details.
    ATR

  • Installed Forms 11g ok but do I need another HTTP Server to run APEX?

    Friends,
    I have posted this Installed Forms 11g ok but do I need another HTTP Server to run APEX? over in the Forms forum. I'm not sure if it's best suited to here?
    I'm not chasing for an answer, just trying to find the correct place for my question.
    Thanks
    Ian

    The answer from a software licensing perspective depends on the licening model you are on. If Unified Workspace Licensing (UWL), then you already have license entitlement to CUP under the Business Edition of that licence program. If you are on a DLU or UCL-based license program, CUP is seperately licensed.
    You will need s seperate MCS server.
    Softphones again depend on your license schema. If UWL, each user is entitled to one softphone. DLU and UCL each charge for softphone usage seperately.

  • Not enough free space when there is - iTunes says I have over 9GB free but when I sync it says I can't as i don't have enough storage and need another 1.3GB!  it's driving me mad!!  help!!

    iTunes says I have over 9GB free but when I sync it says I can't as i don't have enough storage and need another 1.3GB!  it's driving me mad!!  help!!

    Check carefully. Perhaps you are trying to copy 9 GB plus 1.3 GB for a total of 10.3 GB. That would give you the message you see.

  • Do We still need Secondary Indexes on the cubes with BWA being Primary

    Hi Guru's
    Could you please suggest us, do you think we still need secondary Indexes on the cubes with BWA being Primary
    Regards
    Kumar

    Compression: DB statistics and DB indexes for the InfoCubes are less relevant once you use the BI Accelerator. In the standard case, you could even completely forgo these processes. However, note the following aspects:
    Compression is still necessary for inventory InfoCubes, for InfoCubes with a significant number of cancellation requests,
    and for InfoCubes with a high number of partitions in the F-table. Note that compression requires DB statistics and DB
    indexes (P-index).
    DB statistics are necessary in particular for real-time InfoCubes and reading the most current data.
    DB Indexes (index on the time dimension) are necessary in particular if the E fact table is not partitioned. Note also that you
    need compressed and indexed InfoCubes with up-to-date statistics whenever you switch off the BI Accelerator index.
    DB Indexes (index on the time dimension) are necessary in particular if the E fact table is not partitioned.
    Note also that you need compressed and indexed InfoCubes with up-to-date statistics whenever you switch off the BI
    Accelerator index.
    Please refer to the below link for useful information on BIA.
    http://www.sdn.sap.com/irj/sdn/bi?rid=/library/uuid/11c4b71d-0a01-0010-5ca0-aadc2415b137#q-3-2
    Hope this helps.

Maybe you are looking for

  • To Do items showing 'On My Mac' -- how do I get rid of it?

    For some reason my To Do list shows two sublists, On My Mac and my email account name. I have set all To Dos to show up in my email account by default (in Preferences > Composing > Create Notes and To Dos) but 'On My Mac' won't go away. Any ideas?

  • My iphone 4 will not back up calendar events to the icloud!

    Since I installed Mountain Lion and subsequently activated iCloud for the first time I have been having a few issues with Calendars. First issues was all the doubled up events which I eventually sorted out by turning the iCloud settings on and off an

  • AP - F110 - SAPFPAYM - Adobe Checks - Printing Issue

    We have ECC 6.0, and we recently started using Payment medium workbench to print adobe check forms.  All configuration and programming is done, except that we encounter an issue once in a while. Using F110, we will complete a proposal, review it and

  • Using iPayment with Oracle AR

    1. Is there any documentation available on the best practices for implementing iPayment with Oracle AR and iStore? 2. Is there a US law which prohibits internet credit card payment prcoessors from sending line level payment data to internet merchants

  • Picking up and processing files in Order

    Dear all, I have a scenario Legacy(File based Interaction)>PI(PI 7.1)>SAP (ECC 5.0) The legacy system would drop a set of files which would have the suffix "filename_s", "filename_o" in a singh folder. I need to pick the  "_s" files first and then pr