Need help with select stmnt but not loosing unique index scan...

it's 10 g
any way to get this faster using uniqe index?
select * from my_test3
where c1 = :a_value
and c3 = maximum value by c1....
Any work arround so that i do not loose my unique index scan..
i know I can use subquery or some..but that is not a good solution...
SQL> drop table my_test3;
Table dropped.
SQL>
SQL> create table my_test3
  2  (c1 number ,
  3   c3 timestamp );
Table created.
SQL> alter table my_test3
  2   add primary key(c1,c3);
Table altered.
SQL>
SQL> insert into my_test3  values(1,systimestamp);
1 row created.
SQL> insert into my_test3  values(1,systimestamp);
1 row created.
SQL> insert into my_test3  values(1,systimestamp);
1 row created.
SQL> insert into my_test3  values(1,systimestamp);
1 row created.
SQL> insert into my_test3  values(2,systimestamp);
1 row created.
SQL> insert into my_test3  values(3,systimestamp);
1 row created.
SQL> insert into my_test3  values(3,systimestamp);
1 row created.
SQL> insert into my_test3  values(5,systimestamp);
1 row created.
SQL> commit;
Commit complete.
SQL>
SQL> set line 130
SQL> set long 400000
SQL> explain plan for
  2  select * from my_test3
  3  where c1 = :val2
  4  and c3 = :val4;
Explained.
SQL> SELECT * FROM TABLE(dbms_xplan.display);
PLAN_TABLE_OUTPUT
Plan hash value: 964817202
| Id  | Operation         | Name         | Rows  | Bytes | Cost (%CPU)| Time     |
|   0 | SELECT STATEMENT  |              |     1 |    26 |     1   (0)| 00:00:01 |
|*  1 |  INDEX UNIQUE SCAN| SYS_C0047363 |     1 |    26 |     1   (0)| 00:00:01 |
Predicate Information (identified by operation id):
PLAN_TABLE_OUTPUT
   1 - access("C1"=TO_NUMBER(:VAL2) AND "C3"=TO_TIMESTAMP(:VAL4))
13 rows selected.
SQL>

select my.c2 as c1, my.c3 as c3 from (select t3.c1 c2, t3.c3, max(t3.c3) over (partition by t3.c1 ) as cme from my_test3 t3) my
where my.c3 = cme
C1 C3
1 07-MAY-08 01.26.26.617994 PM
2 07-MAY-08 01.26.26.621817 PM
3 07-MAY-08 01.26.26.628041 PM
5 07-MAY-08 01.26.26.631821 PM
| Id  | Operation         | Name         | Rows  | Bytes | Cost (%CPU)| Time     |
|   0 | SELECT STATEMENT  |              |     8 |   312 |     2   (0)| 00:00:01 |
|*  1 |  VIEW             |              |     8 |   312 |     2   (0)| 00:00:01 |
|   2 |   WINDOW BUFFER   |              |     8 |   208 |     2   (0)| 00:00:01 |
|   3 |    INDEX FULL SCAN| SYS_C0025048 |     8 |   208 |     2   (0)| 00:00:01 |
Predicate Information (identified by operation id):
   1 - filter("MY"."C3"="CME")
Note
   - dynamic sampling used for this statementYou'll need to see if you lose the index or not...

Similar Messages

  • Need help with "your purchase can not be completed" when buying an ibook (or anything else for that matter)

    I need help with an error message - "your purchase cannot be completed" when buying something on itunes.

    Lukas --
    Out of curiosity, did you activate the trial software?  Let us know and we will try to help.
    Dale A. Howard [MVP]
    VP of Educational Services
    msProjectExperts
    http://www.msprojectexperts.com
    http://www.projectserverexperts.com
    "We write the books on Project Server"

  • Need help with select that month range with flexible first date

    Hello everyone,
    I am trying to create a selection of month range (will be in a WITH clause) for a report to display monthly data. But the first month start date can be any date. (Not necessarily the first date of the month)
    Examples:
    Report input parameters:
    Start Date: 08/10/12
    End Month: Dec 2012
    I was trying to build a with select that will list
    Month_Start, Month_End
    08/10/12, 31/10/12
    01/11/12, 30/11/12
    01/12/12, 31/12/12
    OR
    Month_Start, Next_Month
    08/10/12, 01/11/12
    01/11/12, 01/12/12
    01/12/12, 01/01/13
    End month is optional, so if no value the select will list only
    08/10/12, 01/11/12
    Oracle Database Details is
    Oracle Database 11g Enterprise Edition Release 11.1.0.7.0 - 64bit Production
    PL/SQL Release 11.1.0.7.0 - Production
    My code so far is
    VARIABLE  P50_START_DATE  VARCHAR2 (10)
    VARIABLE  P50_END_MONTH    VARCHAR2 (10)
    EXEC  :P50_START_DATE  := '10/10/2012';
    EXEC  :P50_END_MONTH   := '31/12/2012';
      SELECT  to_char(:P50_START_DATE) AS start_date
            ,  ADD_MONTHS( TRUNC(to_date(:P50_START_DATE,'DD/MM/YYYY'),'MONTH'), 1) AS next_month
      FROM dual
      union
       SELECT to_char(ADD_MONTHS( TRUNC(to_date(:P50_START_DATE,'DD/MM/YYYY'),'MONTH'), ROWNUM-1)) AS start_date
       ,      ADD_MONTHS( TRUNC(to_date(:P50_START_DATE,'DD/MM/YYYY'),'MONTH'), ROWNUM) AS next_month
       --, rownum
       from all_objects
       where
       rownum <= months_between(to_date(NVL(:P50_END_MONTH, :P50_START_DATE),'DD/MM/YYYY'), add_months(to_date(:P50_START_DATE,'DD/MM/YYYY'), -1))
       and rownum > 1If I put comment – on line and rownum > 1, as
    -- and rownum > 1The result I get is
    START_DATE                     NEXT_MONTH               
    01/10/12                       01/10/12                 
    01/11/12                       01/11/12                 
    01/12/12                       01/01/13                 
    10/10/2012                     01/11/12    But when I try to remove the duplicate period (of the first month) out by restrict rownum, it do not return any rows for the second select at all. The result I get is:
    START_DATE                     NEXT_MONTH               
    10/10/2012                     01/11/12    Can anyone advise what wrong with the select statement ?
    Thanks a lot in advance,
    Ann

    Hi,
    Here's one way:
    WITH   params      AS
         SELECT     TO_DATE (:p50_start_date, 'DD/MM/YYYY')     AS start_date
         ,     TO_DATE (:p50_end_month,  'DD/MM/YYYY')     AS end_date
         FROM     dual
    SELECT     GREATEST ( start_date
               , ADD_MONTHS ( TRUNC (start_date, 'MONTH')
                            , LEVEL - 1
              )               AS month_start
    ,     LEAST     ( end_date
              , ADD_MONTHS ( TRUNC (start_date, 'MONTH')
                          , LEVEL
                        ) - 1
              )               AS month_end
    FROM    params
    CONNECT BY     LEVEL     <= 1 + MONTHS_BETWEEN ( end_date
                                      , TRUNC (start_date, 'MONTH')
    ;:p50_end_month doesn't have to be the last day of the month; any day will work.
    If you want to generate a Counter Table containing the integers 1 througn x in SQL, you could say
    SELECT  ROWNUM  AS n
    FROM    all_objects
    WHERE   ROWNUM  <= x
    ;but, starting in Oracle 9.1, it's much faster to say
    SELECT  LEVEL   AS n
    FROM    dual    -- or any table containing exactly 1 row
    CONNECT BY  LEVEL <= x
    ;Also, x can be greater than the number of rows in all_objects.

  • Please help with ACL "found but not expected," permissions, (and yes I've read /kb/TS1448)

    Hi, I am getting this report from Disk Utility when I repair permissions.
    They keep coming up even if I run repair permissions multiple times.
    Repairing permissions for “SSD ML Clone 928”
    ACL found but not expected on “private/var/root/Library”
    Repaired “private/var/root/Library”
    ACL found but not expected on “private/var/root/Library/Preferences”
    Repaired “private/var/root/Library/Preferences”
    Permissions repair complete
    And, yes I have read Apples Support Page,
    "Mac OS X: Disk Utility's Repair Disk Permissions messages that you can safely ignore,"
    at:
    http://support.apple.com/kb/TS1448
    And, these particular ACL's are not listed on that page, as being ones that can be safely ignored.
    Can anyone tell me for certain if this is anything I should be worried about, (or not), and if it's a problem, what I can do about it?
    Thanks in advance!

    OK, I resorted to running ACLr8 1.3
    I had found a post about running some terminal commands first, and then restarting in recovery mode, and repairing acl's. It was bit complex.
    This app, ACLr8, runs it all in terminal, and without a reboot.
    Disk Utility immediately gave a clean report!
    ACLr8, had been updated for Lion, but hadn't been for ML.
    So although I had some trepidation about running it, my understanding is ML is more of an upgraded Lion than a new OS, so I felt safe taking the risk. 
    And it paid off!
    I suppose it didn't actually fix anything, but hey, out of sight, out of mind!
    And therefore, peace of mind.

  • I need help with color correction (im not sure if what i want its called color correction but i bring examples)

    ok thanks for reading me, im an amateur guy who wants to edit his videos in order to have that look like tv show or cinematic, i dont want just the 2 seconds curves tutorial to improve videos, y want something more like these videos
    https://vimeo.com/48655453
    Buildings & Vampires on Vimeo    (second 30)
    A-Trak & Tommy Trash’s Tuna Melt | The Kid Should See This  (1:32) (and also all the video but more like what i want in 1:32)
    i dont know how to say it but theres a way to make blur and lights way better and i see it in a lot of videos, i can just think of this examples for now but maybe you get it, sorry for my english, hope you can help me

    I would like to direct you to THIS video:
    Behind the Scenes: A-Trak & Tommy Trash - Tuna Melt on Vimeo
    Look at how many people are involved in the shoot.  Look at all the professionals from various disciplines.  Look at all the rehearsal.  Look at all the painstaking attention to detail.  Look at all the professional equipment they used.
    Yes, I looked at the shot at 1:32 in the video they made.  They used a Steadicam to stabilize the camera going up the stairs.  They used gels on the window to reduce the light intensity and help correct the color temperature.  The interior spaces of the upstairs and downstairs have also been lit to avoid irising problems.  They didn't rely on mere chance.
    Did you also notice the subtle cuts at 00:38 and 1:54?   That video was not shot in one take, and that's a fact.  And before they even got to the step of color grading, they KNEW they had good video to work with because they had the professional experience to attain it.

  • Need help with select within select - daterange

    I use Crystal Reports v12.3.0.601 - I am a beginner.
    Problem:
    TABLE: ACCOUNTBILLFEE
    Columns are   
    FOLDERRSN
    STAMPDATE
    BILLNUMBER
    PAYMENTAMOUNT
    There are over 500,000 rows/ records...
    And I need to report the FOLDERRSN which has at least one {ACCOUNTBILLFEE.STAMPDATE} in DateTime
    (2014, 05, 01, 00, 00, 01) to DateTime (2014, 05, 31, 23, 59, 59)
    Out-put required is:
    FOLDERSN | STAMPDATE | BILLNUMBER   | PAYMENTAMOUNT
    Group by FOLDERRSN
    1010234               May01,2014                 1111                      25000
                                  May25, 2014                1112                       5000
                                  Jan 05, 2013                  998                          500
    1034567                May5, 2014                11325                       5000
    1033999                May15, 2014               6752                       15000
                                  Dec5 , 2011                1132                       25000
    Please help -
    The critical part for me, is to display  payments not within the date range in 'select expert' statement.
    Currenlty my report reflects only payments for FOLDERRSN, where {ACCOUNTBILLFEE.STAMPDATE} in DateTime
    (2014, 05, 01, 00, 00, 01) to DateTime (2014, 05, 31, 23, 59, 59) and not other payments outside the date range specified.
    Thank you for your time.

    Hi Abilash,
    This worked !!!
    My brother helped me with it here....ofcourse you have intiated the intial idea.
    It worked when i used the following SQL at 'Add Command'
    Select * from DATABASE_NAME.ACCOUNTBILLFEE A
    Where A.FOLDERSN = any ( select B.FOLDERSN from DATABASE_NAME.ACCOUNTBILLFEE B
    where B.STAMPDATE >= TO_DATE('20140501', 'YYYYMMDD')
    AND  B.STAMPDATE <= TO_DATE('20140531', 'YYYYMMDD'))
    Excellent support - Thank you so much for your immediate attention and response.
    I know, how hard it is to understand someones requirement and suggest solutions.
    You are the best and most helpful I have ever come across in my life.
    Thank you for your kind heart and extending help to me.
    Regs,
    Sridhar Lam

  • Need help with select statement or query

    Not familiar with what to call it, but here is what i need...
    To give our analyst a better idea of warranty on some of our
    equipment, i
    would like to add to the page a column that displays if the
    device is still
    under warranty
    I currently capture the date the equipment was returned from
    repair, so what
    could i use within my select statement or query to display a
    warranty
    expiration date or display on the page...
    example :
    Returned from repair 10/20/2006 warranty expires on
    11/20/2006
    each equipment has different warranties, so i need a formula
    or something to
    say... device #1 has 60 day warranty ( so 10/20/2006 + 60days
    =
    12/19/2006 )
    I would imagine this to be a query
    Table 1 would contain the equipment type and warranty time
    Table 2 would contain the current status of the equipment
    Query would take the back from repair date + warranty =
    expiration date

    Simple. Join the two tables and create a derived column for
    the expiration date. The exact syntax is dependant on your DBMS, so
    check the manual for whichever you are using and look at the date
    functions. There will be a function that will allow you to add a
    number of date units (day, month, year, etc) to a date
    field.

  • Need help with selection.

    Hi all,
    I am working on a project and I want help
    I want to select letter from a word. 
    For example i store the word "Project" , I want a code to select the letters from the word like P r o j e c t  and store them in an array.

    Hello,
    We'll be pleased to help you but you do need more details about your question.
    Are you talking about Microsoft scheduling solution MS Project? In case you're not, please post your question in the appropriate forum.
    If you are, is it the Server version or standalone? Where is the word you want to copy? Which technology to you use?
    Guillaume Rouyre - MBA, MCP, MCTS

  • NEED HELP with T400s ThinkPad, does not work!!

    Hey guys I'm new to this forum.
    Basically I purchased a T400s laptop 4 years ago and have been using it throughout college. Recently I have been having MANY issues and I can't pinpoint the hardware/software problem.
    It constantly overheats, TPfancontrol was able to moderate it for a while but now it is just rediculous. When I click on any application (ie internet explorer) it takes up to 30 seconds to respond, during those 30 seconds the computer would 'freeze'. I am unable to use it now. I tried running a HD diagnostic test but the computer overheated and shutdown before the test could complete.
    A friend has told me that it is probably a HD and RAM problem and that I should upgrade both. At this point I am wondering if I should just buy a new laptop.. I don't have the time to constantly try to fix this laptop and do not have $500 to send it in to get fixed with the risk of it happening again. Any ideas what this problem might be? PLEASE HELP!

    well overheating could be one issue.
    But given that your laptop is really slow even at the boot up, it could mean something else.
    Can you run a hdd diagnostic from your BIOS menu?
    Regards,
    Jin Li
    May this year, be the year of 'DO'!
    I am a volunteer, and not a paid staff of Lenovo or Microsoft

  • I need help with Flash Player, "movie not loaded".

    Sometimes movie loads, sometimes not.  Sometimes loads upon refresh, somtimes not.  I cannot figure out how to get Flash to load reliably.  This happens frequently while surfing the internet with IE10 on Windows 7 64bit sp.  I use Microsoft Security Essentials and Windows Firewall.  I prefer to set pop-up blocking on high but have lowered it to medium to no avail.  I have uninstalled Flash using the step by step instructions on Adobe site and reinstalled version 12.0.0.77 twice.  I have unstalled and reinstalled IE 10.  Clearing the catch does not help.  Clicking in and out of compatability setting also does not get flash to load.  I have run out of ideas.  Is there some setting I am missing.  Flash is on so many sites and its so unreliable it is frustrating.

    Sorry, I thought I had mentioned everything.  Active x filtering is off and Shockwave flash object is enabled.  I have cleared the IE catch and the Flash Player catch.
    I should also point out that it is not that some videos play and others do not,  The same video will work sometimes and sometimes not.  I go back to check and sometimes the video loads and then it doesn't again.  I wondered if it had to do with different advertisers before the link played or something like that.  Something is randomly happening it seems.

  • Need help with select distinct with group by

    RDBMS 10gr2
    I am trying achieve having a select distinct with a order by and after looking on the internet and trying different examples, I have been unsucessful.
    Here is the code working (not sorting - I wish to sort by pps.last_name however I can't seem to get it to work).
    select distinct pps.last_name || ', ' ||pps.first_name || ' ' ||pps.middle_initial || '.' d,
           emple_no r
      from cobr.vw_pps_payroll pps,
           projman pm
    where term_date is null
       and department = '0004400000'
       and pm.eid != pps.emple_no

    SQL> SELECT   ename || '-' || empno, sal
      2      FROM emp_test
      3  ORDER BY ename;
    ENAME||'-'||EMPNO                                                                         SAL
    BLAKE-7698                                                                              20000
    CLARK-7782                                                                              20000
    DAVID-7699                                                                              20000
    FORD-7902                                                                                6000
    JONES-7566                                                                               5950
    KING-7839                                                                               10000
    SCOTT-7788                                                                               6000
    7 ligne(s) sélectionnée(s).
    SQL>

  • I need help with iTunes 7, but its a little more complex than that

    I share a computer with my brother, which makes my situation a little trickier than usual. You see, I want to install the new version of iTunes, but when the setup was done, and it as ready to install, an error occured. I forget the number of the error but it said that I had not given it verification of ownership and that the program could not be stopped. i have a vague idea of what i have to do, i have to wipe my comp clean of iTunes and then download the new version. The problem with that is that my brother is an arrogant idiot who has little patience for anything that he doesn't understand. That's why I'm reluctant to wipe iTunes clean. I know that we can just save our iTunes library in some folder or on a disk, but it'll take me a while to get it through to him that no harm will come. That being, does anyone know how to wipe iTunes off my account only, and then install iTunes 7 on my account only. I got my iPod video for X-mas and its proven to be utterly useless so far. I really hope that one of you can assist me because otherwise, i'll have to deal with a lumbering b

    a few questions before proceeding.
    are you getting an error message? if so, what does it say? include error message numbers if you're getting any.
    or are you getting no error messages whatsoever when you try to launch itunes?
    if you're getting no error messages whatsoever, do you just see the wee hourglass for a few seconds, and then nothing? if so, do you also have Norton Internet Security 2005 installed on that PC?
    or are you seeing a brief "flash" of the itunes license screen (and then nothing)? if so, do you also see similar behavior when you try to launch your QuickTime?

  • I need help with my ipod touch not syncin with my laptop

    my ipod touch does not show up  on itunes(devises)or charge on my laptop.i have windows 8 and this sight doesnt have a resolution for windows 8.it shows up on my file explorer(it has a ! next to it and says a program i downloaded is not allowing or resticting my ipod  from being reconized on my laptop.can some1 plz help me its drivn me crazy and ive tryd all the other solutions and none of it works.i have too charge it on my xbox and can not download any movies or music.Tnx!

    See:
    iOS: Device not recognized in iTunes for Windows
    What is says for Win 7 also applies t Win8.
    I would start with:
    Removing and reinstalling iTunes, QuickTime, and other software components for Windows Vista or Windows 7
    If you  have iTunes 11 turn on the Sidebar. Go to iTunes>View and click on Show Sidebar. You can also do a Crtl+S to show the sidebar. The sidebar is where Devices appears. and Control+B to show the Menu bar
    Also, connect to another computer to help determine if you have an iPod computer problem.

  • Need help with my satellite a105 not sure what is wrong

    I am not sure what is wrong but I think my laptop has viruses and I can not even update my virus software.
    When I go to google and type in anything, say I type in virus protection it takes me to the search results but when I click on any of the sites I get redirected to other search pages. I can not get to any page even if I type it directly in the address bar.
    I do not have a recovery disk that I know of because I was just going to reformat. Any ideas of what I can do?  a computer guy wants $125.00 to fix it.
    thank you
    Denise

    The problem is that, a lot of things work themselves deep into the Registry.  Clearly you have some kind of click hijacker on your system if all your links are going places you don't want. 
    OK, so you can try a couple of things.
    First, figure out if there is a way to update your anti-virus without doing it from within the program.  It may be possible to download the update files on your other computer and burn them to CD.  I would not recommend any method other than a CD-Rom.  If you use a USB flash stick you may transfer the infection back to your other computer.  If that's not possible...
    Secondly, you can download a program called Hijack This on your other computer.  http://www.trendsecure.com/portal/en-US/tools/security_tools/hijackthis  It will tell you what is running on startup, what kind of browser helper objects (BHO's) you have in your browser, etc.  If you can get this installed and run, post the log here, that will be useful to getting it fixed.
    A205-S7442
    C2D 1.5
    4GB Kingston Value RAM
    120GB Fujitsu HDD
    Windows 7 beta

  • Need help with selecting an LCD TV that can wirelessly connect to my laptop

    I specifically need to have the ability to view my laptop's display wirelessly on the tv.  My office is going to use it as a presentation display so when I'm in a power point presentation on my laptop it is actually displayed on the tv.  Please let me know what tv's allow this or if there is an accessory I can purchase to make the connection.  I'm hoping there is a blue tooth type option or a USB receiver that can be used.

    I have an LG 55" TV that allows me to stream from my router to the TV via cat5.  It isDLNA compatible, so it can receive signals from any compatible device.
    If you find my post useful or informative, please click the icon below with the plus sign and star to give kudos. Thank you!

Maybe you are looking for

  • Using JDBC Adapter posting data from Oracle database to Falt file????

    Hi All,   By using JDBC adapter, for now I have to connect to Oracle Database and then get the employee information from the Employee Table and post it to the flat file, can you please help me out the complete procedure... Thanks in advance Andy

  • How good is the audio jack?

    In the past I've connected my iPod to my stereo using a mini to RCA adapter. It gave me a weak signal (even with the volume turned all the way up). How good is the Mac Mini's audio when plugging into a stereo? Thanks.

  • CAn't see disks

    Hi, I tried to install solaris 10 on E4000. There are 2 disks on disk board but these are not visible by system. Even probe-scsi-all only shows the dvd rom. Please help. Thanks.

  • Firefox 12 crashes my OSX 10.7.4 system, even when Firefox is running in Safe Mode

    Firefox 12 crashes unexpectedly. The whole OSX system hangs for unknown behaviors, i.e. opening new tab, selecting link, refreshing page, changing tab. It is non-specific or non-apparent. I also have frequent spinning color disks...sometimes they don

  • Just updated, now older pictures in library show "unsupported format"

    Help! My aperture library consist of pictures shot with a Nikon d80 and now a D300. Just tonight I installed the raw update. Now many of the photo files show as "unsupported format" of they have a green or purple color cast, While other are just fine