Using Sort Merge Hint

Hi,
I'm trying to force oracle to use the sort merge using hints.
Can anyone suggest why the below code is working correctly?
Please see the explain plan.
Regards, Chris.
set autotrace on
timing start
select /*+ use_merge(e) */ e.fk, d.fk
FROM girl d, boy e
WHERE e.fk = d.fk;
timing stop
spool off
set termout on
SQL> timing stop
Elapsed: 00:00:00.42
SQL> spool off
not spooling currently
SQL> set termout on
SQL> select * from girl WHERE fk = 1;
PK NAME FK
1 Hayley 1
1 julie 1
1 sian 1
Execution Plan
| Id | Operation | Name | Rows | Bytes | Cost |
| 0 | SELECT STATEMENT | | 3 | 114 | 3 |
| 1 | TABLE ACCESS FULL| GIRL | 3 | 114 | 3 |
Note
- 'PLAN_TABLE' is old version
Statistics
5 recursive calls
0 db block gets
16 consistent gets
0 physical reads
0 redo size
573 bytes sent via SQL*Net to client
381 bytes received via SQL*Net from client
2 SQL*Net roundtrips to/from client
0 sorts (memory)
0 sorts (disk)
3 rows processed

Thanks Dmytro, I'd just in fact solved the problem myself.
THE SQL required both tables in the brackets.
Thanks all for your help!

Similar Messages

  • How can I use mail merge with numbers in the new pages version?

    I am trying to use mail merge with the new version of pages and can not seem to be able to figure it out. PLEASE HELP!!!

    Nope. Version 5 is a fashion accessory: it looks like software, but it doesn;t actually do anything. Sort of like a sports car with a lawn-mower engine. Looks snzzy. Doesn't really work. (And given how buggy it is, I should further specifiy that the lawn-mower engine comes with a blade: it chews up your old templates, produces files that cannot be sent as email attahcments [yes, really], and—this just in—doesn;t play well with the new SMB facility of Mavericks. In short, as one reviewer put it, "un unmitigated disaster."

  • Nested loop join v/s Sort merge

    I have seen that nested loops are better if the inner table is being indexed, because for each outer table row, we are looking for a match in the inner table. But is there any case when optimizer still goes for a nested loop even if there is no index on the inner table. That is my first question ?
    My second question := When doing a sort merge join oracle has to sort both result sets and then merge them. Oracle says that if both the row sets, if already sorted is definately better for performance. Ya thats obvious. But back to my upper question, when there is no index on the inner table, is it the situation when oracle goes for a sort merge join ?

    My response should really have examples but since I do not have any handy I will just say about your first question. If there is no index available from table A to table B yes it is possible a nested loop join may still be used and table B read via full table scan within a nested loop. If table B is very small and consists of only a block or two this may be relatively efficient plan. It is more likely you sould see table B full scanned and the result feed into a hash join, but I have seen the plan you mention.
    Back before hash joins were introduced with 7.3 (if my memory is correct) you would see sort/merge joins used more often than you do now. Generally speaking no index on the join conditions would exist for this option to be chosen.
    If you really want to know why and sometimes what the optimizer is going to do buy Jonathan Lewis's book Cost-Based Oracle Fundamentals. If explains the optimizer in more depth than any other source I know of.
    HTH -- Mark D Powell --

  • NESTED LOOP or SORT MERGE

    Hi All,
    How can we judge which one is best to use for the query- NESTED LOOP
    - SORT MERGE
    - HASH JOINThanx.. Ratan

    Hi...
    For Nested Loop Joins:
    Nested loop joins are useful when small subsets of data are being joined and if the join condition is an efficient way of accessing the second table.
    It is very important to ensure that the inner table is driven from (dependent on) the outer table. If the inner table's access path is independent of the outer table, then the same rows are retrieved for every iteration of the outer loop, degrading performance considerably. In such cases, hash joins joining the two independent row sources perform better.
    For Hash Join:
    Hash joins are used for joining large data sets. The optimizer uses the smaller of two tables or data sources to build a hash table on the join key in memory. It then scans the larger table, probing the hash table to find the joined rows.
    For Sort Merge Joins:
    Sort merge joins can be used to join rows from two independent sources. Hash joins generally perform better than sort merge joins. On the other hand, sort merge joins can perform better than hash joins if both of the following conditions exist:
    The row sources are sorted already.
    A sort operation does not have to be done.
    However, if a sort merge join involves choosing a slower access method (an index scan as opposed to a full table scan), then the benefit of using a sort merge might be lost.
    Sort merge joins are useful when the join condition between two tables is an inequality condition (but not a nonequality) like <, <=, >, or >=. Sort merge joins perform better than nested loop joins for large data sets. You cannot use hash joins unless there is an equality condition.
    In a merge join, there is no concept of a driving table. The join consists of two steps:
    Sort join operation: Both the inputs are sorted on the join key.
    Merge join operation: The sorted lists are merged together.
    If the input is already sorted by the join column, then a sort join operation is not performed for that row source.

  • Sort-Merge outer join, why? when?

    Hi All,
    How Oracle runs/optimizes outer joins has always been my subject of curiocity.
    In Oracle documentation V 10.1 -> Performance tuning guide -> Chap. 14 ( The Query Optimizer) -> Go almost at the bottom
    There is a small section of "Sort Merge outer joins".
    It has a sentence
    "When an outer join cannot drive from the outer (preserved) table to the inner (optional) table, it cannot use a hash join or nested loop joins. Then it uses the sort merge outer join for performing the join operation"
    Can you help me understanding this ??
    Thanks in advance

    You actually need a sort-merge join sometimes: a join on inequality can't be run as a hash join, and may be very inefficient as a nested loop.
    e.g.
    select ...
    where  del.delivery_date between ord.order_date + 5 and ord.order_date + 8Unfortunately there are other cases where a sort merge join could be a very efficient join mechansim - because of suitable indexes - but the optimizer won't take it because there is a bug (from my perspective, at any rate) in the cost for sorting.
    Regards
    Jonathan Lewis
    http://jonathanlewis.wordpress.com
    http://www.jlcomp.demon.co.uk

  • Using split/merge

    What I want to be able to do is nudge certain notes left or right a tad in order to tighten up timing.  I've been trying to use the Split tool for this, but to no avail.
    * I can split the note I want from the rest of the track, and I can move that split section to a new track, extend or reduce the front and tail ends of the split so that everything flows continuously,  and then do a mixdown of both tracks to a new track.
    or...
    * I can split the note I want from the rest of the track, extend or reduce the front and tail ends of the split so that everything flows continuously, and then use the Merge/rejoin Split to restore the integrity of the track.
    Problem: the second method doesn't work, because the Merge/Split command is greyed out and inactive.  What am I doing wrong?  The second approach would be a lot less work.

    Aw, go on... *somebody* must know something about the split/merge function.  Here, look, I'll make it worth your while to respond.  You can go like: "Dobro, you ninny, you never ever get it.  This stuff is so simple.  Haven't you rtfm?"  And I'll go: "Well, I've read *some* of the manual, but the bit I read didn't help much, actually."  And you can sort of sigh heavily and look down toward the floor as if inspiration might be down there somewhere between your feet and the pizza crumbs.
    And then you can tell me.

  • Hairlines between shapes after using the merge tool (Pathfinder)

    Hi all,
    I have this complicated camouflage like design made of all sorts of shapes but only using 5 colours.
    None of my elements have strokes.
    I selected all, and used the merge tool in the pathfinder (because I need to provide the document without any shapes overlapping).
    When you look close at the result you notice that there are white hairlines around every shapes.
    It's really a gap because If I slide a red rectangle behind the artwork, it appears in the hairlines.
    I read the other illustrator "hairlines" topics here but couldn't find a workaround to my problem.
    Thank you all in advance!

    If I untick Preferences>General>Anti-Aliased Artwork?
    The hairlines all magically disappear !
    Does that mean that it was just a screen artefact and they will not print?
    I had saved it as PDF but the lines where still showing in the PDF.
    But in Acrobat Pro if I's uncheck the smooth line art, they would disappear.
    Thank you so much Jacob!!!

  • How to accumlate and use sort in ALV

    Hi
    I am using collect statement for accumalation.
    but it is not working.
    the code is like this:
      IF NOT p_otrstk  IS INITIAL.
        CLEAR it_zresult_tab1.
        LOOP AT it_mard_tab INTO wa_mard_tab.
          l_tabix = sy-tabix.
          READ TABLE it_zresult_tab1 INTO wa_zresult_tab1
            WITH KEY lgort = s_lgort1
                     lgort = s_lgort2
                     werks = s_werks
                     matnr = s_matnr.
          IF sy-subrc EQ 0.
            wa_zresult_tab1-speme = wa_mard_tab-speme.
            wa_zresult_tab1-umlme = wa_mard_tab-umlme.
            wa_zresult_tab1-insme = wa_mard_tab-insme.
            wa_zresult_tab1-retme = wa_mard_tab-retme.
            COLLECT wa_zresult_tab1 INTO it_zresult_tab1.
          ENDIF.
        ENDLOOP.
      ENDIF.
    do i need to use modify? but it is with modify it is giving dump.
    and how to do subtotals in ALV grid?
    the code is like this:
      IF grid1 IS INITIAL .
    Instantiate the grid container.
        CREATE OBJECT g_custom_container
        EXPORTING container_name = 'CCCONTAINER'.
    *Instantiate the grid itself within the container.
        CREATE OBJECT grid1
        EXPORTING
        i_parent = g_custom_container.
       i_appl_events = 'X'.
    Call method of grid1 class object to build/display the grid.
        CALL METHOD grid1->set_table_for_first_display
        EXPORTING
             i_structure_name = 'ZRESULT_TAB'
             is_variant =  variant
            i_save = 'U'
            is_layout = gs_layout
        CHANGING
            it_outtab = it_zresult_tab
            it_fieldcatalog = gt_fcat
            IT_SORT  = VT_SORT
        EXCEPTIONS
            invalid_parameter_combination = 1
            program_error = 2
            too_many_lines = 3
            OTHERS = 4
        IF sy-subrc <> 0.
          MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
          WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
        ENDIF.
    and in the fieldcatalog
    IF p_some  = 'X'.
      CLEAR: ls_sort.
       t_fcat-no_out     = 'X'.
         ls_sort-fieldname = 'MATNR'.
        ls_sort-subtot    = 'X'.
        APPEND ls_sort TO vt_sort.
    but this is also not working.
    Please help me.....
    Thanks
    Alekhya

    Hi,
    go thru this sample program which uses sort and sums the data
    report  yalv2  .
    declare data areas for listviewer******************
    type-pools:slis.
    data:g_repid like sy-repid,
    gs_layout type slis_layout_alv,
    gt_fieldcat type slis_t_fieldcat_alv,
    fieldcat_ln type slis_fieldcat_alv,
    gt_sort type slis_t_sortinfo_alv,
    gs_sort type slis_sortinfo_alv,
    gt_events type slis_t_event,
    gs_event type slis_alv_event,
    gt_list_top_of_page type slis_t_listheader,
    gs_line type slis_listheader,
    col_pos type i.
    data:begin of itab,
    field1(5) type c,
    field2(5) type c,
    field3(5) type p decimals 2,
    end of itab.
    data:begin of itab1 occurs 0.
            include structure itab.
    data:end of itab1.
    data:begin of itab_fieldcat occurs 0.
            include structure itab.
    data:end of itab_fieldcat.
    initialization.
      g_repid = sy-repid.
    start-of-selection.
      move 'test1' to itab1-field1.
      move 'test1' to itab1-field2.
      move '10.00' to itab1-field3.
      append itab1.
      move 'test2' to itab1-field1.
      move 'test2' to itab1-field2.
      move '20.00' to itab1-field3.
      append itab1.
      do 200 times.
        append itab1.
      enddo.
    end-of-selection.
      <b>perform build_fieldcat.</b> 
      <b>perform build_sortcat.</b>
      perform build_eventcat changing gt_events.
      perform build_commentcat changing gt_list_top_of_page.
      perform call_alv.
    *&      Form  build_fieldcat
          text
    -->  p1        text
    <--  p2        text
    form build_fieldcat .         "data field catalog, explain field desc
                                      "to alv
      fieldcat_ln-fieldname = 'FIELD1'.
      fieldcat_ln-tabname = 'ITAB1'.
      fieldcat_ln-key = ' '.                          "subtotal key
      fieldcat_ln-no_out = ' '.
      fieldcat_ln-seltext_l = 'HEAD1'.
      append fieldcat_ln to gt_fieldcat.
      fieldcat_ln-fieldname = 'FIELD2'.
      fieldcat_ln-tabname = 'ITAB1'.
      fieldcat_ln-no_out = ' '.
      fieldcat_ln-seltext_l = 'HEAD2'.
      append fieldcat_ln to gt_fieldcat.
      fieldcat_ln-fieldname = 'FIELD3'.
      fieldcat_ln-tabname = 'ITAB1'.
      fieldcat_ln-ref_tabname = 'MSEG'.
      fieldcat_ln-ref_fieldname = 'MENGE'.
      fieldcat_ln-no_out = ' '.
      fieldcat_ln-do_sum = 'X'.                       "sum upon display
      append fieldcat_ln to gt_fieldcat.
    endform.                    " build_fieldcat
    *&      Form  build_sortcat
          text
    -->  p1        text
    <--  p2        text
    form build_sortcat .           "data sorting and displaying subtotal
      clear gs_sort.
      gs_sort-fieldname = 'FIELD1'.
      gs_sort-spos = '1'.
      gs_sort-up = 'X'.
      append gs_sort to gt_sort.
      clear gs_sort.
      gs_sort-fieldname = 'FIELD2'.
      gs_sort-spos = '2'.
      gs_sort-up = 'X'.
      append gs_sort to gt_sort.
    endform.                    " build_sortcat
    *&      Form  build_eventcat
          text
         <--P_GT_EVENTS  text
    form build_eventcat  changing lt_events type slis_t_event.
    constants:
    gc_formname_top_of_page type slis_formname value 'TOP-OF-PAGE'.
    call function 'REUSE_ALV_EVENTS_GET'
    EXPORTING
       I_LIST_TYPE           = 0
    IMPORTING
       ET_EVENTS             = lt_events
    read table lt_events with key name = slis_ev_top_of_page into gs_event.
    if sy-subrc = 0.
    move gc_formname_top_of_page to gs_event-form.
    append gs_event to lt_events.
    endif.
    endform.                    " build_eventcat
    *&      Form  build_commentcat
          text
         <--P_GT_LIST_TOP_OF_PAGE  text
    form build_commentcat  changing gt_top_of_page type slis_t_listheader.
    clear gs_line.
    gs_line-typ = 'H'.
    gs_line-info = 'HEADER 1'.
    append gs_line to gt_top_of_page.
    clear gs_line.
    gs_line-typ = 'S'.
    gs_line-key = 'STATUS 1'.
    gs_line-info = 'INFO 1'.
    append gs_line to gt_top_of_page.
    clear gs_line.
    gs_line-typ = 'S'.
    gs_line-key = 'STATUS 2'.
    gs_line-info = 'INFO 2'.
    append gs_line to gt_top_of_page.
    endform.                    " build_commentcat
    form top_of_page.
    call function 'REUSE_ALV_COMMENTARY_WRITE'
      exporting
        it_list_commentary       = gt_list_top_of_page.
    write: sy-datum, 'Page no', sy-pagno left-justified.
    endform.
    form end-of-page.
    write at (sy-linsz) sy-pagno centered.
    endform.
    *&      Form  call_alv
          text
    -->  p1        text
    <--  p2        text
    form call_alv .
    call function 'REUSE_ALV_LIST_DISPLAY'
    EXPORTING
       I_CALLBACK_PROGRAM             = g_repid
       I_STRUCTURE_NAME               = 'ITAB1'
       IS_LAYOUT                      = gs_layout
       IT_FIELDCAT                    = gt_fieldcat
       IT_SORT                        = gt_sort
       IT_EVENTS                      = gt_events
      tables
        t_outtab                       = ITAB1
    endform.                    " call_alv
    Regards,
    Sowjanya.
    Message was edited by: sowjanya suggula

  • Error when using sort variant 0005 for RABEWG01 (tcode za353)

    Hi SAP experts,
    I have a problem with program RABEWG01 (tcode za353). When I use sort variant 0005 and execute it, I get this error:
    Table ANLV is not supported in the requested report
    Message no. AB066
    Diagnosis
    You requested sort version 0005 for the current report. The sort version contains a field in table ANLV. However, the report does not process this table. Therefore the sort version cannot access this table and this field.
    System Response
    The report is not executed with sort version 0005.
    Procedure
    Enter a sort version that uses only valid tables. The following tables are supported in the current report:
    ANLAV ANLB
    Can someone help me to explain why ANLV is not supported in the requested report? If we can't use sort variant 0005, why is it there in the first place?
    ==========================================
    Field:
    Company code: 001
    Report date: 30.03.2011
    Dep area: 01
    do I need to add any more entries in the field so that i can use sort variant 0005? thanks!

    Hi,
    note 21719 explains the reason for he error:                                                                               
    " Fields from tables ANLP and ANLV can only be used in a sort version if    
    the same tables are used in the relevant report (currently only the case    
    with reports RAGAFA01 and RAVERS01). If these fields are used in other      
    reports, runtime error GET_WA_NOT_ASSIGNED could occur..."    
    regards Bernhard

  • In LR6CC, after using the merge to HDR and the photo returns to LR as a DRG, it is not automatically put into a previously set up stack. For example a stack of three photos. If I use NIK HDR and the photo returns to LR, the stack is automatically changed

    In LR6CC, after using the merge to HDR and the photo returns to LR as a DRG, it is not automatically put into a previously set up stack. For example a stack of three photos. If I use NIK HDR and the photo returns to LR, the stack is automatically changed from 3 to 4. When LR's HDR merge brings a photo back into LR's library, the stack number does not change and the DRG version isn't included in the stack.

    Hi,
    The Ps CS6 public beta version contains the same camera support as found in Ps CS5/5.5 compatible CR 6.6. There will be future updates to CR 7 for Ps CS6 to pick up more camera support. The Nikon D800 NEF files are not supported, yet.
    If you like to work with your D800 files in the public beta build now, you'll have to get the DNG Converter 6.7 from here: http://labs.adobe.com/technologies/cameraraw6-7/
    and convert your files to DNG.
    regards,
    steve

  • Can you place text from a word document using data merge?

    I'm working with a charity that is giving away scholarships/grants. I need to create a ducument that pulls in various application data plus their submitted essay (docx format). I would like to do this via data merge but cannot find any reference if it is possible.
    Please help, I really need to automate as much as possible since this is a side project.
    Kevin

    Data merge only collects info from CSV format - which I expect you would export from Excel. (I think it'll take tab-delimited as well, but that's it.)
    MS Word files can be placed, but Data Merge is not the tool to automate placing of Word-file content. If there is no formatting of their essays, I suspect you could use VBA to cause entire essays to occupy a single cell in Excel. But that would be the only way to use Data Merge to automate import of essays into InDesign.
    Maybe if you tell us more we can give you some more automation suggestions. (I spend a lot of time automating translation workflows, but I still place Word files. All day long, in fact.)
    (edited for spelling)

  • Why does an InDesign document exported to PDF using data merge result in very different sized PDFs?

    I've got a small sheet that I update on occasion and use data-merge to add people's names to the sheet. It's very much like an invitation where every invite has a different name on it. I use the data merge feature to select a list of names and then they get inserted into the document. Then I use the Export to PDF command in the data merge window to create a pdf that has all of the invitations in one big file. They are four-up per page on letter sized paper. Sometimes I print 2000 of them and the resulting PDF is about 2mb, sometimes I print 1000 of them and it's 20mb. Document, settings, method of issueing the commands to output the files are all the same. The only difference is the list of names and those are all almost identical in length. Anyone know what could be happening?
    One clue is that it takes about a minute to run when the result is going to be a small file and about 5 or more minutes when the result is going to be a large file.
    My guess is that sometimes it includes a copy of the images once per page, and sometimes it only includes them once per document, but I'd love to know why and how to control that. Thanks.

    And you verified that the links panel shows everything as up-to-date?
    The only other things I can suggest at the moment are the standard two trouble shooting steps: Remove minor corruption by exporting and Replace Your Preferences

  • Error while using sort by key lexicographically

    Hi,
    while sorting records lexicographically using sort by key function, i got the below error.
    RuntimeException in Message-Mapping transformation: Runtime exception during processing target field mapping /ns0:MT_WorkOrderData/MessagePayload/Record/CAUFVD_KTEXT. The message is: Exception:[java.lang.IllegalArgumentException: Cannot parse apple to BigDecimal. ] in class com.sap.aii.mappingtool.flib3.NodeFunctions method sortByKey[com.sap.aii.mappingtool.flib3.Plainer@264b264b, com.sap.aii.mappingtool.flib3.Plainer@42674267]
    i need to sort the input records from a file based on a field which is of type string.
    Thanks in advance,
    Jhansi.

    Jhansi,
    Did u referred the thread:Re: Problem in sorting the records
    Best regards,
    raj.

  • How do I automate a large catalog with several unique sections using Data Merge and Microsoft Excel?

    My boss would like me to use data merge to create a catalog with 300+ pages and unique data fields on almost every page. It is an informational catalog that would contain pictures and several unique fitment and specification fields for each product that we sell and manufacture on each page. For years the catalog was made and modified manually in quark express. Is it possible to use data merge to recreate such a complex document? Does anyone have any useful reccomendations or links for tackling this project? I really appreciate any advice or help.
    Thank You,
    Kevin
    Message was edited by: kpalombi

    Online video
    http://tv.adobe.com/watch/instant-indesign/automating-a-catalog-with-data-merge/
    Software
    http://www.65bit.com/home/home.shtm
    Data Merge Tips
    http://www.theindesigner.com/blog/episode-43-data-merge-video

  • Dropping table indexes prior to using the MERGE utility

    I am being asked to change the processing done when updates are being applied to the database.
    Process:
    1. Initial data load - Use SQL Loader to load the main database tables.
    2. Daily data load - Use SQL Loader to load records to temporary tables and then use MERGE utility to insert new records and update existing records in the main database tables. Just prior to starting the MERGE utility, I drop the indexes on the main database tables. At the end of the MERGE, I re-create the indexes.
    The problem seems to be the application using the database can't handle the queries if the indexes are dropped and being readded.
    Does anyone have any ideas?

    I am currently dropping indexes because when the MERGE processing takes place, it can insert new records or update existing records (based on the primary keys matching).
    When I started to use the MERGE, I don't think the update was successful because the primary key constraint. So I disabled the primary keys indexing and other contraints during the MERGE. Then recreated at the end of the MERGE. Perhaps I need to revisit the information for MERGE.
    I don't have any real benchmarking other than the application developers indicating that they experience the application processing delay during the daily load. I've thought about loading into a shadow table and rename at the end of the load but it not really be possible now.

Maybe you are looking for