"IN" clause making query to run infinite loop

Hello Masters,
I am using Oracle 9i and using one query with "IN" clause. This query takes arnd 5-6 hours of time to get that completed, but when i removed the "IN" clause with "Inner Join" then query starts completing in seconds.
More over looking at the execution plan for the queries i don't see any differences and the costing is also very low.
Query is:
SELECT contact_id FROM scc_case_contact_t WHERE case_id IN (SELECT id FROM temp_data_manager_t WHERE id_info = 'mDependentCaseIds' AND user_id = 1 AND sess_id = '1769F72A8F7A7B1FB98AAAE6676845F6') AND contact_id IN (SELECT id FROM temp_data_manager_t WHERE id_info = 'arrCntIds' AND user_id = 1 AND sess_id = '1769F72A8F7A7B1FB98AAAE6676845F6')
Execution Plan:
| Id | Operation | Name | Rows | Bytes | Cost |
| 0 | SELECT STATEMENT | | 1 | 272 | 5 |
| 1 | NESTED LOOPS SEMI | | 1 | 272 | 5 |
| 2 | NESTED LOOPS SEMI | | 1 | 142 | 5 |
| 3 | INDEX FAST FULL SCAN | CASE_CONTACT_PK | 94729 | 1110K| 5 |
| 4 | TABLE ACCESS BY INDEX ROWID| TEMP_DATA_MANAGER_T | 1 | 130 | |
| 5 | INDEX RANGE SCAN | TEMP_DATA_MANAGER_IX_ID_INFO | 1 | | |
| 6 | TABLE ACCESS BY INDEX ROWID | TEMP_DATA_MANAGER_T | 1 | 130 | |
| 7 | INDEX RANGE SCAN | TEMP_DATA_MANAGER_IX_ID_INFO | 1 | | |
Almost all the queries with "IN" clause are taking astonishingly high time.
The same set of queries are working fine at Oracle 10G.
Any help on this will be highly appreciated.

This is the modified query
SELECT contact_id FROM scc_case_contact_t inner join
(SELECT id FROM temp_data_manager_t WHERE id_info = 'mDependentCaseIds' AND user_id = 1 AND sess_id LIKE '1769F72A8F7A7B1FB98AAAE6676845F6')X
on X.id=case_id
inner join
(SELECT id FROM temp_data_manager_t WHERE id_info = 'arrCntIds' AND user_id = 1 AND sess_id LIKE '1769F72A8F7A7B1FB98AAAE6676845F6')Y
on Y.ID=contact_id
Execution plan is:
| Id | Operation | Name | Rows | Bytes | Cost |
| 0 | SELECT STATEMENT | | 1 | 272 | 1 |
| 1 | NESTED LOOPS | | 1 | 272 | 1 |
| 2 | MERGE JOIN CARTESIAN | | 1 | 260 | 1 |
| 3 | TABLE ACCESS BY INDEX ROWID | TEMP_DATA_MANAGER_T | 1 | 130 | 1 |
| 4 | INDEX RANGE SCAN | TEMP_DATA_MANAGER_IX_ID_INFO | 1 | | 1 |
| 5 | BUFFER SORT | | 1 | 130 | |
| 6 | TABLE ACCESS BY INDEX ROWID| TEMP_DATA_MANAGER_T | 1 | 130 | |
| 7 | INDEX RANGE SCAN | TEMP_DATA_MANAGER_IX_ID_INFO | 1 | | |
| 8 | INDEX UNIQUE SCAN | CASE_CONTACT_PK | 1 | 12 | |
I had tried using Exists but that also not working and taking arnd 4 -5 hrs.
Also the query with Join condition is completing in 4-5 seconds.

Similar Messages

  • ABAP-query going in infinite loop

    Hello all,
    I have one on abap-query in which i am displaying data for delivery details that is table LIKP and LIPS.
    In this query i also have some code to get the sale order details from the  the delivery details.
    I have also used one FM module in this query as well as select endselet  stamt.
    When i run my quey it i going in infinite loop.  I am not getting any thing . Each time i have to exit the screen.
    Can anyone please tell me wat is the problem, why it is going in infinite  loop.
    Thanks and regards
    Sachin yadav

    thanks for your help,
    But may i know how to display my internal table data to out put screen.
    As i am new to the query i do not know how to display internal table data to report along with my data coming from ABAp-query.
    for eg i have three field to display suppose A , B and C.
    Field A and B are coming from query and i have to display field C from internal table.
    How to do that
    thanks in advance

  • How to exit infinite loop when using gotopage( )

    I have 10 Pages in one script. At page 9, I want to call page 2 , page 3 and page4
    The method is : RSWApp.GotoPage (2)
    At page 9 it will run infinite loop page2-page4, How can I stop this loop at Page4
    Thanks
    Julia

    Hi, I have a question follow up on this.
    For example:
    I have 5 pages:
    Page 1
    Page 2
    Page 3
    Page 4
    Page 5
    In Page 1, I have an VBA that look like this:
    if something then GoToPage 2
    if otherthing then GoToPage 4.
    But I only want when the page get to Page 3, then this iteration is finished and don't want to keep going to Page 4 and Page 5.
    How do I stop it or restart another iteration, start all over from Page 1?
    I have tried "RSWApp.StopIteration", look up some end, exit, etc, doesn't seems work.
    Thanks

  • How to set vo query at run time

    Hi,
    Is it possible to bind the where clause of query at run time.
    N :)

    Hi,
    Yes its possible.
    To add new where clause to your query.
    vo.setWhereClause(null);//If you want to remove any existing programmatically added where clause.
    vo.setWhereClause("Your new query");
    To bind varibales (Say there are 2 bind variables),
    First way to achieve this.
    setWhereClauseParam(null); //Always reset it to remove existing bindings)
    setWhereClauseParam(0, "Your first paramter value"); // Second parameter "Your first paramter value" is of type object.
    setWhereClauseParam(1, "Your first paramter value");
    In case you use "?" styly type binding, this count in above method starts with 1 instead of 0.
    Second way is to put all bind variables in an object array and pass to above method.
    Vector params=new Vector(2);
    params.addElement("FirstParameter");
    params.addElement("SecondParameter");
    Now call vo.executeQuery() to fetch the results as per new query.
    Abdul Wahid

  • Memory requirement is continiously increased when i am running my application program in an infinite loop,after certain time it shows an error called low virtual memory

    memory requirement is continiously increased when i am running my application program in an infinite loop,after certain time it shows an error called low virtual memory

    What are you doing with your program. Lots of improper programming techniques can cause this - building arrays, concantanating strings, opening but not closing refrences, etc. Need more details or post your VI. Also, have you looked at "LabVIEW Performance and Memory Management"? It's part of the shipping documentation and available from Help>Search the LabVIEW Bookshelf.

  • Can anyone figure out why this runs into an infinite loop?

    Hi,
    I have the following class, and if i run it, I encounter an infinite loop. I have pinpointed the problem and it is because of the lines:
    try {
                UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
            catch (Exception exp) {
                   System.err.println("Failed");
                exp.printStackTrace();
            }Here is the class. Any and all help is greatly appreciated. Thanks!
    package org.aemf.clinical.tol.gui.printing;
    import org.aemf.clinical.tol.model.TOLBion;
    import org.aemf.clinical.tol.model.Range;
    import javax.swing.table.AbstractTableModel;
    import javax.swing.*;
    import java.awt.print.*;
    import java.awt.*;
    import java.util.Iterator;
    import java.util.ArrayList;
    * Created by IntelliJ IDEA.
    * User: arashn
    * Date: Feb 9, 2005
    * Time: 1:26:38 PM
    public class printTableTest implements Printable, Pageable {
         private PageFormat pf;
         private String[] headers = { "Heading 1", "Heading 2", "Heading 3"};
         private java.util.List bions = null;
         private ArrayList<Object[][]> data = new ArrayList<Object[][]>();
         public printTableTest(PageFormat format) {
              this.pf = format;
         public int getNumberOfPages() {
            return 1;
        public PageFormat getPageFormat(int pageIndex) throws IndexOutOfBoundsException {
            return pf;
         public void setBions(java.util.List b) {
              bions = b;
              for(int x=0; x < 3; x++) {
                   //TOLBion bion = (TOLBion) bions.get(x);
                   int ndx = 0;
                   //Object[][] tempData = new Object[bion.getNumRanges()][3];
                   Object[][] tempData = new Object[2][3];
              //     for (Iterator itr = bion.getRanges(); ndx < 2 && itr.hasNext(); ) {
                   for (; ndx < 2 ; ) {
                   // Range range = (Range)itr.next();
                        //tempData[ndx] = new Object[] { new Integer(range.getFrequency()), range.getLowerBound(), range.getUpperBound() };
                        tempData[ndx] = new Object[] { "col 1: " + x, "col 2: " + x, "col 3: " + x };
                        ndx++;
                   data.add(tempData);
        public Printable getPrintable(int pageIndex) throws IndexOutOfBoundsException {
            return this;
         public int print(Graphics g, PageFormat format, int pageIndex) throws PrinterException {
              if(pageIndex > 1) {
                   return Printable.NO_SUCH_PAGE;
                                                                              System.err.println("Page: " + pageIndex);
              JFrame frame = null;
              JTable tableView = null;
              Graphics2D g2 = (Graphics2D) g;
              //Object[][] data = new Object[3][3];
              g2.setColor(Color.black);
              g2.translate(format.getImageableX() + 72, format.getImageableY() + 72);
              for(int x=0; x < data.size(); x++) {
                   tableView = new JTable(new PrintTableModel(headers, data.get(x)));
                   frame = new JFrame();
                   JScrollPane scrollpane = new JScrollPane(tableView);
                   scrollpane.setPreferredSize(new Dimension(300, 80));
                   frame.getContentPane().setLayout(new BorderLayout());
                   frame.getContentPane().add(BorderLayout.CENTER,scrollpane);
                   frame.pack();
                   tableView.paint(g2);
                   g2.translate(0, - tableView.getTableHeader().getHeight());
                   tableView.getTableHeader().paint(g2);
                   g2.translate(0, format.getImageableHeight()/3);
              return Printable.PAGE_EXISTS;
         public static void main(String args[]) {
              PrinterJob printerJob = PrinterJob.getPrinterJob();
              try {
                UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
            catch (Exception exp) {
                   System.err.println("Failed");
                exp.printStackTrace();
             int INCH = 72;
              double LETTER_WIDTH = 8.5 * INCH;
              double LETTER_HEIGHT = 11 * INCH;
            Paper paper = new Paper();
              int margin = INCH/6; // << set your margins here
              double pageWidth = LETTER_WIDTH - 2 * margin;
              double pageHeigth = LETTER_HEIGHT - 2 * margin;
              paper.setImageableArea(margin, margin, pageWidth, pageHeigth) ;
              PageFormat format = printerJob.defaultPage();
              format.setPaper(paper);
            printTableTest pp = new printTableTest(format);
            pp.setBions(new ArrayList());
              printerJob.setPageable(pp);
              boolean doPrint = printerJob.printDialog();
              if (doPrint) {
                   try {
                        printerJob.print();
                   } catch (PrinterException exception) {
                        System.err.println("Printing error: " + exception);
             System.exit(0);
         private class PrintTableModel extends AbstractTableModel {
              private Object[][] data = null;
              private String[] headers = null;
              public PrintTableModel(String[] headers, Object[][] data) {
                   this.headers = headers;
                   this.data = data;
              public int getColumnCount() { return headers.length; }
              public int getRowCount() { return data.length; }
              public Object getValueAt(int row, int col) { return data[row][col]; }
              public String getColumnName(int column) { return headers[column]; }
              public Class getColumnClass(int col) { return getValueAt(0,col).getClass(); }
              public boolean isCellEditable(int row, int col) { return false; }
              public void setValueAt(Object aValue, int row, int column) { data[row][column] = aValue; }
    }

    I have managed to create an even simpler version which tries to print the same header 3 times. Again, if you remove the setLookAndFeel line, everything works out great.
    import javax.swing.table.*;
    import javax.swing.*;
    import java.awt.print.*;
    import java.awt.*;
    * Created by IntelliJ IDEA.
    * User: arashn
    * Date: Feb 9, 2005
    * Time: 1:26:38 PM
    public class printTableTest implements Printable, Pageable {
         private PageFormat pf;
         public printTableTest(PageFormat format) {
              this.pf = format;
         public int getNumberOfPages() {
            return 1;
        public PageFormat getPageFormat(int pageIndex) throws IndexOutOfBoundsException {
            return pf;
        public Printable getPrintable(int pageIndex) throws IndexOutOfBoundsException {
            return this;
         public int print(Graphics g, PageFormat format, int pageIndex) throws PrinterException {
              if(pageIndex > 1) {
                   return Printable.NO_SUCH_PAGE;
              System.err.println("Printing Page: " + pageIndex);
              Graphics2D g2 = (Graphics2D) g;
              g2.setColor(Color.black);
              g2.translate(format.getImageableX() + 72, format.getImageableY() + 72);
              DefaultTableColumnModel dtcm = new DefaultTableColumnModel();
              TableColumn tc = new TableColumn();
              tc.setHeaderValue("Heading 1");
              dtcm.addColumn(tc);
              tc.setHeaderValue("Heading 2");
              dtcm.addColumn(tc);
              tc.setHeaderValue("Heading 2");
              dtcm.addColumn(tc);
              JTableHeader tableHeader = new JTableHeader(dtcm);
              JScrollPane scrollpane2 = new JScrollPane(tableHeader);
              scrollpane2.setPreferredSize(new Dimension(300, 80));
              JFrame frame2 = new JFrame();
              frame2.getContentPane().add(BorderLayout.NORTH,scrollpane2);
              frame2.pack();
              for(int x=0; x < 3; x++) {                   
                   tableHeader.paint(g2);
                   g2.translate(0, format.getImageableHeight()/3);
              return Printable.PAGE_EXISTS;
         public static void main(String args[]) {
              PrinterJob printerJob = PrinterJob.getPrinterJob();
              try {
                UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
            catch (Exception exp) {
                   System.err.println("Failed");
                exp.printStackTrace();
             int INCH = 72;
              double LETTER_WIDTH = 8.5 * INCH;
              double LETTER_HEIGHT = 11 * INCH;
            Paper paper = new Paper();
              int margin = INCH/6; // << set your margins here
              double pageWidth = LETTER_WIDTH - 2 * margin;
              double pageHeigth = LETTER_HEIGHT - 2 * margin;
              paper.setImageableArea(margin, margin, pageWidth, pageHeigth) ;
              PageFormat format = printerJob.defaultPage();
              format.setPaper(paper);
            printTableTest pp = new printTableTest(format);
              printerJob.setPageable(pp);
              boolean doPrint = printerJob.printDialog();
              if (doPrint) {
                   try {
                        printerJob.print();
                   } catch (PrinterException exception) {
                        System.err.println("Printing error: " + exception);
             System.exit(0);
    }

  • How to cancel a bpm running into an infinite loop

    Hi all,
    I have a business process in my file to file scenario and I am using a while loop to
    process the messages and it is going into infinite loop.
    Now I have corrected the problem and when I reprocess it ,it is using the same original condition for it again the infinite loop.
    So what I understood is I need to cancel out the previous business process which is running into infinite loop .so can you please help me out how do I stop the message processing (and it is not error status also).i,e the business process before I start the fresh test case.
    Thanks in advance,
    Vengal.

    Hi Vengal,
    You can put a condition inside the loop, and whenever that condition will met, it will exit from the loop.
    First of all declare one integer (Int_temp) under container operation.
    Inside the container operation properties, give the variable name and other info as shown below:
    <u><b>Container Operation</b></u>
    Target -
    > Int_temp
    Operation -
    > Assign
    Expression------> Int_temp
    Operator -
    > +
    Experssion -
    > '1'
    Now inside loop properties you can write the condition as shown below:
    Condition -
    > <b>(Int_temp &#8800; 2)</b> (this is just an example)
    The efect of this condition will be on loop till <b>Int_temp</b> is not equal to 2, as soon as it will become 2, it will exit from the loop.
    above is one simple example, there can be several methods.
    I hope it will help you.
    Regards,
    Sarvesh
    ****Reward Points, if found helpfull.

  • I have a subVI that is running in an infinite loop. Which subVI is it?

    I have a top level VI that's running and it calls many subVIs. One of those subVIs is stuck in an infinite loop and won't let the top level subVI finish running. Is there and easy way to figure out which subVI is the culprit. The best I can figure is to go into the VI hierarchy and open every front panel until I find the one that has the "running" run arrow. 
    CLD (2014)

    Greetings,
    Even with many sub-vi's using the highlight execution in conjunction with breakpoints should identify your infinity loop pretty easy. If your code is "all over the place" it may take a little bit more time, but if it's done correctly should work like a charm. Just make sure to install breakpoints accordingly (after loops) so you're not waiting for any loops to execute hundreds of times in highlight mode. And if you never reach your breakpoint, well, you know it's in the loop prior to the breakpoint, and can debug from there.You should be able to systematically break it down in no time.
    Good Luck.
    Chazzmd

  • I run into an infinite loop when I try and use this print method

    Hi,
    I have the following class. If i run it in stand alone, everything works out great. However, if I call it from a much larger application (which is why I have built this class), I run into an infinite loop. I have no idea why, but I have pinpointed it to the line: tableView.getTableHeader().paint(g2);
    Any help is greatly appreciated. I have been tryin to figure this out for a week now, and I havent gotten anywhere. It makes no sense to me, since this works as a standalone application, but if i put a method similar to the main() inside a much larger application, I end up with an inifinite loop.
    Thanks again!
    import javax.swing.table.AbstractTableModel;
    import javax.swing.*;
    import java.awt.print.*;
    import java.awt.*;
    import java.util.Iterator;
    import java.util.ArrayList;
    public class printTableTest implements Printable, Pageable {
         private PageFormat pf;
         private String[] headers = { "Heading 1", "Heading 2", "Heading 3"};
         private ArrayList<Object[][]> data = new ArrayList<Object[][]>();
         public printTableTest(PageFormat format) {
              this.pf = format;
                                               this.setObjects();
         public int getNumberOfPages() {
            return 1;
        public PageFormat getPageFormat(int pageIndex) throws IndexOutOfBoundsException {
            return pf;
         public void setObjects() {
              for(int x=0; x < 3; x++) {
                   int ndx = 0;
                   Object[][] tempData = new Object[2][3               for (; ndx < 2 ; ) {
                        tempData[ndx] = new Object[] { "col 1: " + x, "col 2: " + x, "col 3: " + x };
                        ndx++;
                   data.add(tempData);
        public Printable getPrintable(int pageIndex) throws IndexOutOfBoundsException {
            return this;
         public int print(Graphics g, PageFormat format, int pageIndex) throws PrinterException {
              JFrame frame = null;
              JTable tableView = null;                                                       System.err.println("here");
              Graphics2D g2 = (Graphics2D) g;
              //Object[][] data = new Object[3][3];
              g2.setColor(Color.black);
              g2.translate(format.getImageableX() + 72, format.getImageableY() + 72);
              for(int x=0; x < data.size(); x++) {
                   tableView = new JTable(new PrintTableModel(headers, data.get(x)));
                   frame = new JFrame();
                   JScrollPane scrollpane = new JScrollPane(tableView);
                   scrollpane.setPreferredSize(new Dimension(300, 80));
                   frame.getContentPane().setLayout(new BorderLayout());
                   frame.getContentPane().add(BorderLayout.CENTER,scrollpane);
                   frame.pack();
                   tableView.paint(g2);
                   g2.translate(0, - tableView.getTableHeader().getHeight());
                   tableView.getTableHeader().paint(g2);
                   g2.translate(0, format.getImageableHeight()/3);
              return Printable.PAGE_EXISTS;
         public static void main(String args[]) {
             PrinterJob printerJob = PrinterJob.getPrinterJob();
              printTableTest pp = new printTableTest( printerJob.defaultPage());
              printerJob.setPageable(pp);
              boolean doPrint = printerJob.printDialog();
              if (doPrint) {
                   try {
                        printerJob.print();
                   } catch (PrinterException exception) {
                        System.err.println("Printing error: " + exception);
             System.exit(0);
         private class PrintTableModel extends AbstractTableModel {
              private Object[][] data = null;
              private String[] headers = null;
              public PrintTableModel(String[] headers, Object[][] data) {
                   this.headers = headers;
                   this.data = data;
              public int getColumnCount() { return headers.length; }
              public int getRowCount() { return data.length; }
              public Object getValueAt(int row, int col) { return data[row][col]; }
              public String getColumnName(int column) { return headers[column]; }
              public Class getColumnClass(int col) { return getValueAt(0,col).getClass(); }
              public boolean isCellEditable(int row, int col) { return false; }
              public void setValueAt(Object aValue, int row, int column) { data[row][column] = aValue; }
    }

    Log the parameters passed to my print method?
    The only parameter that would be relevant would be the pageNumber, and I can tell you that it continues to loop. Here is an example of the output:
    Page: 0
    Page: 0
    Page: 0
    Page: 0
    Page: 0
    Page: 0
    Page: 0
    Page: 0
    Page: 0
    Page: 0
    Page: 0
    Page: 0
    Page: 0
    Page: 0
    Page: 0
    Page: 0
    Page: 0
    Page: 0
    Page: 0
    Page: 0
    Page: 0
    Page: 0
    Page: 0
    Page: 0
    Page: 0
    Page: 0
    Page: 0
    Page: 0
    Page: 0
    Page: 0
    Page: 0
    Page: 0
    Page: 0
    Page: 0
    Page: 0
    Page: 0
    Page: 0
    Page: 0
    Page: 0
    Page: 0
    and here is the Thread Trace:
    AWT-EventQueue-0@42f prio=6, in group "main", status: WAIT
           wait():-1, Object.java
           wait():474, Object.java
           getNextEvent():345, EventQueue.java
           pumpOneEventForHierarchy():189, EventDispatchThread.java
           pumpEventsForHierarchy():163, EventDispatchThread.java
           pumpEvents():157, EventDispatchThread.java
           pumpEvents():149, EventDispatchThread.java
           run():110, EventDispatchThread.java
    AWT-Shutdown@430 prio=5, in group "main", status: WAIT
           wait():-1, Object.java
           wait():474, Object.java
           run():259, AWTAutoShutdown.java
           run():595, Thread.java
    Java2D Disposer@2a0 daemon prio=10, in group "main", status: WAIT
           wait():-1, Object.java
           remove():116, ReferenceQueue.java
           remove():132, ReferenceQueue.java
           run():107, Disposer.java
           run():595, Thread.java
    AWT-Windows@fc daemon prio=6, in group "main", status: RUNNING
           eventLoop():-1, WToolkit.java
           run():269, WToolkit.java
           run():595, Thread.java
    Signal Dispatcher@2a2 daemon prio=10, in group "system", status: RUNNING
    Finalizer@2a3 daemon prio=8, in group "system", status: WAIT
           wait():-1, Object.java
           remove():116, ReferenceQueue.java
           remove():132, ReferenceQueue.java
           run():159, Finalizer.java
    Reference Handler@2a4 daemon prio=10, in group "system", status: WAIT
           wait():-1, Object.java
           wait():474, Object.java
           run():116, Reference.java
    main@1 prio=5, in group "main", status: RUNNING
           print():68, printTableTest.java
           redrawRegion():906, WPathGraphics.java
           printPage():1817, RasterPrinterJob.java
           print():1334, RasterPrinterJob.java
           print():1196, RasterPrinterJob.java
           main():1922, TOLMainFrame.java

  • Script making Flash 9 running slow Error

    Hey guys i have a site that manage uploads for our content
    providers, but when you run the flash movie and you start uploading
    a file, somewhere is the middle of the upload, a message pops
    saying that a script in the movie is making the flash player to run
    slow, and thta you computer may turn unresponive, after googling
    for this error i find out that my script may have a infinitive loop
    or function, i've been tryint to find the error on my scrip but
    with no luck, here is the code, if anyone have a chance to take a
    look will be appreciate it. thanks in advance.

    Can you repost your code so that it is displayed line by line
    rather than one long line?

  • Interrupting a process involving an infinite loop

    I am using a JInternalFrame, with a JSplitPane, and panels within the SplitPane. My application involves the server continuously listening to a port.
    When this happens, I am not able to STOP the process (the while(true)) loop, the buttons do not respond, and the JInternalFrame freezes. During this time, if I switch from this application to another application (while the processing is on), the controls disappear, and I am not able to view anything, until an OptionPane (which I have used to indicate the completion of an event0 appears.
    Ideally, a user must be able to QUIT the application whenever he/she wants to, but my application does not allow the user to do this.
    Please can anyone suggest a way out of this???
    Thanks in advance :-)
    p.s. : I hope the information I provided is sufficient to help reply to my query...... :-?

    Thanks for your help, but please could you explain
    the solution better?
    I am not using threads in my program..............
    Then, why is it giving a problem?
    Is it because the server is listening to a port in an
    infinite loop, and that blocks all other processes,
    even prevents me frmo exiting the application!!! Is
    there any way out of this? I mean, can I interrupt
    the server listening to the port, and if so, how can
    this be done????The problem is that you have a loop in your program that is running on the EDT. That loop is hogging 100% of the CPU, preventing anything else from running.

  • Parallel hint causes a query to run slower?

    I have an insert...select query where the select is a join between a table with one billion rows (although there is a where clause on an indexed column that restricts it to "only" 300 million), a table with 30 million rows, and a table with about 100,000 rows, where the result is about 20 rows. When I first ran it, it took about 2 hours. I added a Parallel hint, and explain plan showed that it was being used (and v$session showed that I had about 30 additional connections while it ran). but not it takes four hours.
    Is there a reason parallel processing would cause a query to run slower?
    insert /*+ append */ into employees_by_age_group
      pay_plan
    , age_range
    , pay_level
    , fy
    , employee_count
    select /*+ parallel */
           emp.pay_plan
         , to_char(d.min_age) || '-' || to_char(d.max_age) as age_range
         , emp.pay_level
         , pay.fy
         , count(pay.employee_id) as employee_count
    from
      select /*+ index(pay_info pay_info_index_on_site) */
             employee_id
           , extract(year from (dte_ppe_end + 92)) as fy
           , count(employee_id) as num_recs
      from pay_info
      where extract(month from dte_ppe_end) = 10
      and   extract(day from dte_ppe_end) between 14 and 27
      and   substr(pay_type, 1, 1) IN ('A', 'B', 'C')
      and   site like 'Z%'
      group by employee_id, extract(year from (dte_ppe_end + 92))
    ) pay
    join
      select employee_id
           , pay_plan
           , pay_grade
           , pay_step
           , file_date
      from
        select /*+ index(employee_info employee_info_index_on_site) */
               employee_id
             , pay_level
             , file_date
             , max(file_date)
               over (partition by extract(year from (file_date + 61)))
               as last_file_date
        from employee_info
        where site like 'Z%'
      where file_date = last_file_date
    ) emp
    on (
         emp.employee_id = pay.employee_id
         and extract(year from emp.file_date) = pay.fy - 1
    join (
           select employee_id
                , dob
           from (
                  select employee_id
                       , date_birth
                       , row_number() over (partition by employee_id order by date_file desc) as r
                  from employee_birthdates
                  where site like 'Z%'
           where r = 1
         ) dob
    on dob.employee_id = pay.employee_id
    join
                select 20 as min_age, 24 as max_age from dual
      union all select 25 as min_age, 29 as max_age from dual
      union all select 30 as min_age, 34 as max_age from dual
      union all select 35 as min_age, 39 as max_age from dual
      union all select 40 as min_age, 44 as max_age from dual
      union all select 45 as min_age, 49 as max_age from dual
      union all select 50 as min_age, 54 as max_age from dual
      union all select 55 as min_age, 59 as max_age from dual
      union all select 60 as min_age, 64 as max_age from dual
      union all select 65 as min_age, 69 as max_age from dual
      union all select 70 as min_age, 74 as max_age from dual
      union all select 75 as min_age, 79 as max_age from dual
      union all select 80 as min_age, 84 as max_age from dual
      union all select 85 as min_age, 89 as max_age from dual
      union all select 90 as min_age, 94 as max_age from dual
      union all select 95 as min_age, 99 as max_age from dual
    ) d
    group by emp.pay_plan, d.min_age, d.max_age, emp.pay_level, pay.fy;

    Paul - here are three different explain plans
    First, the original one (without the parallel hint):
    INSERT STATEMENT  ALL_ROWS                                              Cost: 26,684,255  Bytes: 114  Cardinality: 1                     
      35 LOAD AS SELECT EMPLOYEES_BY_AGE_GROUP                  
        34 HASH GROUP BY                                                    Cost: 26,684,255  Bytes: 114  Cardinality: 1                 
          33 NESTED LOOPS                                                   Cost: 26,684,254  Bytes: 114  Cardinality: 1               
            14 HASH JOIN                                                    Cost: 26,684,222  Bytes: 108  Cardinality: 1             
              9 MERGE JOIN                                                  Cost: 4,408,803  Bytes: 8,322  Cardinality: 146           
                3 VIEW DONBOT_DBA.                                          Cost: 114,863  Bytes: 29,625,180  Cardinality: 987,506         
                  2 WINDOW SORT PUSHED RANK                                 Cost: 114,863  Bytes: 35,550,216  Cardinality: 987,506       
                    1 TABLE ACCESS FULL TABLE EMPLOYEE_BIRTHDATES           Cost: 108,983  Bytes: 35,550,216  Cardinality: 987,506     
                8 SORT JOIN                                                 Cost: 4,293,940  Bytes: 3,645  Cardinality: 135         
                  7 VIEW DONBOT_DBA.                                        Cost: 4,293,939  Bytes: 3,645  Cardinality: 135       
                    6 SORT GROUP BY                                         Cost: 4,293,939  Bytes: 4,185  Cardinality: 135     
                      5 TABLE ACCESS BY INDEX ROWID TABLE PAY_INFO          Cost: 4,293,938  Bytes: 4,185  Cardinality: 135   
                        4 INDEX RANGE SCAN INDEX PAY_INFO_INDEX_ON_SITE     Cost: 487,124  Cardinality: 402,683,034 
              13 VIEW DONBOT_DBA                                            Cost: 22,275,300  Bytes: 1,160,143,257  Cardinality: 22,747,907           
                12 WINDOW SORT                                              Cost: 22,275,300  Bytes: 841,672,559  Cardinality: 22,747,907         
                  11 TABLE ACCESS BY INDEX ROWID TABLE EMPLOYEE_INFO        Cost: 22,137,046  Bytes: 841,672,559  Cardinality: 22,747,907       
                    10 INDEX RANGE SCAN INDEX EMPLOYEE_INFO_INDEX_ON_SITE   Cost: 50,419  Cardinality: 38,019,281     
            32 VIEW DONBOT_DBA
              31 UNION-ALL           
                15 FAST DUAL  Cost: 2  Cardinality: 1         
                16 FAST DUAL  Cost: 2  Cardinality: 1         
                17 FAST DUAL  Cost: 2  Cardinality: 1         
                18 FAST DUAL  Cost: 2  Cardinality: 1         
                19 FAST DUAL  Cost: 2  Cardinality: 1         
                20 FAST DUAL  Cost: 2  Cardinality: 1         
                21 FAST DUAL  Cost: 2  Cardinality: 1         
                22 FAST DUAL  Cost: 2  Cardinality: 1         
                23 FAST DUAL  Cost: 2  Cardinality: 1         
                24 FAST DUAL  Cost: 2  Cardinality: 1         
                25 FAST DUAL  Cost: 2  Cardinality: 1         
                26 FAST DUAL  Cost: 2  Cardinality: 1         
                27 FAST DUAL  Cost: 2  Cardinality: 1         
                28 FAST DUAL  Cost: 2  Cardinality: 1         
                29 FAST DUAL  Cost: 2  Cardinality: 1         
                30 FAST DUAL  Cost: 2  Cardinality: 1          Next, one with the parallel hint:
    INSERT STATEMENT  ALL_ROWS                                                                              Cost: 26,507,111  Bytes: 114  Cardinality: 1                                       
      51 LOAD AS SELECT EMPLOYEES_BY_AGE_GROUP
        50 PX COORDINATOR                                          
          49 PX SEND QC (RANDOM) PARALLEL_TO_SERIAL SYS.:TQ10005 :Q1005                                     Cost: 26,507,111  Bytes: 114  Cardinality: 1                                 
            48 HASH GROUP BY PARALLEL_COMBINED_WITH_PARENT :Q1005                                           Cost: 26,507,111  Bytes: 114  Cardinality: 1                               
              47 PX RECEIVE PARALLEL_COMBINED_WITH_PARENT :Q1005                                            Cost: 26,507,111  Bytes: 114  Cardinality: 1                             
                46 PX SEND HASH PARALLEL_TO_PARALLEL SYS.:TQ10004 :Q1004                                    Cost: 26,507,111  Bytes: 114  Cardinality: 1                           
                  45 HASH GROUP BY PARALLEL_COMBINED_WITH_PARENT :Q1004                                     Cost: 26,507,111  Bytes: 114  Cardinality: 1                         
                    44 NESTED LOOPS PARALLEL_COMBINED_WITH_PARENT :Q1004                                    Cost: 26,507,111  Bytes: 114  Cardinality: 1                       
                      25 HASH JOIN PARALLEL_COMBINED_WITH_PARENT :Q1004                                     Cost: 26,507,109  Bytes: 108  Cardinality: 1                     
                        17 PX RECEIVE PARALLEL_COMBINED_WITH_PARENT :Q1004                                  Cost: 4,301,500  Bytes: 4,104  Cardinality: 72                   
                          16 PX SEND HASH PARALLEL_TO_PARALLEL SYS.:TQ10003 :Q1003                          Cost: 4,301,500  Bytes: 4,104  Cardinality: 72                 
                            15 HASH JOIN PARALLEL_COMBINED_WITH_PARENT :Q1003                               Cost: 4,301,500  Bytes: 4,104  Cardinality: 72               
                              7 BUFFER SORT PARALLEL_COMBINED_WITH_CHILD :Q1003           
                                6 PX RECEIVE PARALLEL_COMBINED_WITH_PARENT :Q1003                           Cost: 4,293,939  Bytes: 1,809  Cardinality: 67           
                                  5 PX SEND BROADCAST PARALLEL_FROM_SERIAL SYS.:TQ10000                     Cost: 4,293,939  Bytes: 1,809  Cardinality: 67         
                                    4 VIEW DONBOT_DBA.                                                      Cost: 4,293,939  Bytes: 1,809  Cardinality: 67       
                                      3 SORT GROUP BY                                                       Cost: 4,293,939  Bytes: 2,077  Cardinality: 67     
                                        2 TABLE ACCESS BY INDEX ROWID TABLE PAY_INFO                        Cost: 4,293,938  Bytes: 2,077  Cardinality: 67   
                                          1 INDEX RANGE SCAN INDEX PAY_INFO_INDEX_ON_SITE                   Cost: 487,124  Cardinality: 199,756,151 
                              14 VIEW PARALLEL_COMBINED_WITH_PARENT DONBOT_DBA. :Q1003                      Cost: 7,561  Bytes: 29,625,180  Cardinality: 987,506             
                                13 WINDOW SORT PUSHED RANK PARALLEL_COMBINED_WITH_PARENT :Q1003             Cost: 7,561  Bytes: 35,550,216  Cardinality: 987,506           
                                  12 PX RECEIVE PARALLEL_COMBINED_WITH_PARENT :Q1003                        Cost: 7,561  Bytes: 35,550,216  Cardinality: 987,506         
                                    11 PX SEND HASH PARALLEL_TO_PARALLEL SYS.:TQ10002 :Q1002                Cost: 7,561  Bytes: 35,550,216  Cardinality: 987,506       
                                      10 WINDOW CHILD PUSHED RANK PARALLEL_COMBINED_WITH_PARENT :Q1002      Cost: 7,561  Bytes: 35,550,216  Cardinality: 987,506     
                                        9 PX BLOCK ITERATOR PARALLEL_COMBINED_WITH_CHILD :Q1002             Cost: 7,557  Bytes: 35,550,216  Cardinality: 987,506   
                                          8 TABLE ACCESS FULL TABLE PARALLEL_COMBINED_WITH_PARENT EMPLOYEE_BIRTHDATES :Q1002     Cost: 7,557  Bytes: 35,550,216  Cardinality: 987,506 
                        24 BUFFER SORT PARALLEL_COMBINED_WITH_CHILD :Q1004                 
                          23 PX RECEIVE PARALLEL_COMBINED_WITH_PARENT :Q1004                                Cost: 22,205,605  Bytes: 575,504,145  Cardinality: 11,284,395                 
                            22 PX SEND HASH PARALLEL_FROM_SERIAL SYS.:TQ10001                               Cost: 22,205,605  Bytes: 575,504,145  Cardinality: 11,284,395               
                              21 VIEW DONBOT_DBA.                                                           Cost: 22,205,605  Bytes: 575,504,145  Cardinality: 11,284,395             
                                20 WINDOW SORT                                                              Cost: 22,205,605  Bytes: 417,522,615  Cardinality: 11,284,395           
                                  19 TABLE ACCESS BY INDEX ROWID TABLE EMPLOYEE_INFO                        Cost: 22,137,046  Bytes: 417,522,615  Cardinality: 11,284,395         
                                    18 INDEX RANGE SCAN INDEX EMPLOYEE_INFO_INDEX_ON_SITE                   Cost: 50,419  Cardinality: 18,859,958       
                      43 VIEW PARALLEL_COMBINED_WITH_PARENT DONBOT_DBA. :Q1004                              Cost: 32  Bytes: 6  Cardinality: 1                     
                        42 UNION-ALL PARALLEL_COMBINED_WITH_PARENT :Q1004                 
                          26 FAST DUAL PARALLEL_COMBINED_WITH_PARENT :Q1004         Cost: 2  Cardinality: 1                 
                          27 FAST DUAL PARALLEL_COMBINED_WITH_PARENT :Q1004         Cost: 2  Cardinality: 1                 
                          28 FAST DUAL PARALLEL_COMBINED_WITH_PARENT :Q1004         Cost: 2  Cardinality: 1                 
                          29 FAST DUAL PARALLEL_COMBINED_WITH_PARENT :Q1004         Cost: 2  Cardinality: 1                 
                          30 FAST DUAL PARALLEL_COMBINED_WITH_PARENT :Q1004         Cost: 2  Cardinality: 1                 
                          31 FAST DUAL PARALLEL_COMBINED_WITH_PARENT :Q1004         Cost: 2  Cardinality: 1                 
                          32 FAST DUAL PARALLEL_COMBINED_WITH_PARENT :Q1004         Cost: 2  Cardinality: 1                 
                          33 FAST DUAL PARALLEL_COMBINED_WITH_PARENT :Q1004         Cost: 2  Cardinality: 1                 
                          34 FAST DUAL PARALLEL_COMBINED_WITH_PARENT :Q1004         Cost: 2  Cardinality: 1                 
                          35 FAST DUAL PARALLEL_COMBINED_WITH_PARENT :Q1004         Cost: 2  Cardinality: 1                 
                          36 FAST DUAL PARALLEL_COMBINED_WITH_PARENT :Q1004         Cost: 2  Cardinality: 1                 
                          37 FAST DUAL PARALLEL_COMBINED_WITH_PARENT :Q1004         Cost: 2  Cardinality: 1                 
                          38 FAST DUAL PARALLEL_COMBINED_WITH_PARENT :Q1004         Cost: 2  Cardinality: 1                 
                          39 FAST DUAL PARALLEL_COMBINED_WITH_PARENT :Q1004         Cost: 2  Cardinality: 1                 
                          40 FAST DUAL PARALLEL_COMBINED_WITH_PARENT :Q1004         Cost: 2  Cardinality: 1                 
                          41 FAST DUAL PARALLEL_COMBINED_WITH_PARENT :Q1004         Cost: 2  Cardinality: 1                  Finally, one without the parallel hint, and without the index hint on PAY_TABLE:
    INSERT STATEMENT  ALL_ROWS                                              Cost: 23,348,654  Bytes: 114  Cardinality: 1                   
      34 LOAD AS SELECT ARMYMP.EMPLOYEES_BY_AGE                
        33 HASH GROUP BY                                                    Cost: 23,348,654  Bytes: 114  Cardinality: 1               
          32 NESTED LOOPS                                                   Cost: 23,348,653  Bytes: 114  Cardinality: 1             
            13 HASH JOIN                                                    Cost: 23,348,621  Bytes: 108  Cardinality: 1           
              8 MERGE JOIN                                                  Cost: 1,073,202  Bytes: 8,322  Cardinality: 146         
                3 VIEW DONBOT_DBA.                                          Cost: 114,863  Bytes: 29,625,180  Cardinality: 987,506       
                  2 WINDOW SORT PUSHED RANK                                 Cost: 114,863  Bytes: 35,550,216  Cardinality: 987,506     
                    1 TABLE ACCESS FULL TABLE EMPLOYEE_BIRTHDATES           Cost: 108,983  Bytes: 35,550,216  Cardinality: 987,506   
                7 SORT JOIN                                                 Cost: 958,339  Bytes: 3,645  Cardinality: 135       
                  6 VIEW DONBOT_DBA.                                        Cost: 958,338  Bytes: 3,645  Cardinality: 135     
                    5 SORT GROUP BY                                         Cost: 958,338  Bytes: 4,185  Cardinality: 135   
                      4 TABLE ACCESS FULL TABLE PAY_INFO                    Cost: 958,337  Bytes: 4,185  Cardinality: 135 
              12 VIEW DONBOT_DBA.                                           Cost: 22,275,300  Bytes: 1,160,143,257  Cardinality: 22,747,907         
                11 WINDOW SORT                                              Cost: 22,275,300  Bytes: 841,672,559  Cardinality: 22,747,907       
                  10 TABLE ACCESS BY INDEX ROWID TABLE EMPLOYEE_INFO        Cost: 22,137,046  Bytes: 841,672,559  Cardinality: 22,747,907     
                    9 INDEX RANGE SCAN INDEX EMPLOYEE_INFO_UIC              Cost: 50,419  Cardinality: 38,019,281   
            31 VIEW DONBOT_DBA.                                             Cost: 32  Bytes: 6  Cardinality: 1           
              30 UNION-ALL         
                14 FAST DUAL  Cost: 2  Cardinality: 1       
                15 FAST DUAL  Cost: 2  Cardinality: 1       
                16 FAST DUAL  Cost: 2  Cardinality: 1       
                17 FAST DUAL  Cost: 2  Cardinality: 1       
                18 FAST DUAL  Cost: 2  Cardinality: 1       
                19 FAST DUAL  Cost: 2  Cardinality: 1       
                20 FAST DUAL  Cost: 2  Cardinality: 1       
                21 FAST DUAL  Cost: 2  Cardinality: 1       
                22 FAST DUAL  Cost: 2  Cardinality: 1       
                23 FAST DUAL  Cost: 2  Cardinality: 1       
                24 FAST DUAL  Cost: 2  Cardinality: 1       
                25 FAST DUAL  Cost: 2  Cardinality: 1       
                26 FAST DUAL  Cost: 2  Cardinality: 1       
                27 FAST DUAL  Cost: 2  Cardinality: 1       
                28 FAST DUAL  Cost: 2  Cardinality: 1       
                29 FAST DUAL  Cost: 2  Cardinality: 1        I am surprised the cost without the index is less than the cost with it, considering that it is replacing a Table Access By Index Rowid with a Table Access Full on a table with 1 billion (1000 million) records.
    Igor - two questions:
    One - I cannot find "Materialize" in the hints in the SQL Reference anywhere. What does it do?
    Two - does replacing subqueries with With clauses make that much of a difference?

  • SQL stored procedure Staging.GroomDwStagingData stuck in infinite loop, consuming excessive CPU

    Hello
    I'm hoping that someone here might be able to help or point me in the right direction. Apologies for the long post.
    Just to set the scene, I am a SQL Server DBA and have very limited experience with System Centre so please go easy on me.
    At the company I am currently working they are complaining about very poor performance when running reports (any).
    Quick look at the database server and CPU utilisation being a constant 90-95%, meant that you dont have to be Sherlock Holmes to realise there is a problem. The instance consuming the majority of the CPU is the instance hosting the datawarehouse and in particular
    a stored procedure in the DWStagingAndConfig database called Staging.GroomDwStagingData.
    This stored procedure executes continually for 2 hours performing 500,000,000 reads per execution before "timing out". It is then executed again for another 2 hours etc etc.
    After a bit of diagnosis it seems that the issue is either a bug or that there is something wrong with our data in that a stored procedure is stuck in an infinite loop
    System Center 2012 SP1 CU2 (5.0.7804.1300)
    Diagnosis details
    SQL connection details
    program name = SC DAL--GroomingWriteModule
    set quoted_identifier on
    set arithabort off
    set numeric_roundabort off
    set ansi_warnings on
    set ansi_padding on
    set ansi_nulls on
    set concat_null_yields_null on
    set cursor_close_on_commit off
    set implicit_transactions off
    set language us_english
    set dateformat mdy
    set datefirst 7
    set transaction isolation level read committed
    Store procedures executed
    1. dbo.p_GetDwStagingGroomingConfig (executes immediately)
    2. Staging.GroomDwStagingData (this is the procedure that executes in 2 hours before being cancelled)
    The 1st stored procedure seems to return a table with the "xml" / required parameters to execute Staging.GroomDwStagingData
    Sample xml below (cut right down)
    <Config>
    <Target>
    <ModuleName>TransformActivityDim</ModuleName>
    <WarehouseEntityName>ActivityDim</WarehouseEntityName>
    <RequiredWarehouseEntityName>MTV_System$WorkItem$Activity</RequiredWarehouseEntityName>
    <Watermark>2015-01-30T08:59:14.397</Watermark>
    </Target>
    <Target>
    <ModuleName>TransformActivityDim</ModuleName>
    <WarehouseEntityName>ActivityDim</WarehouseEntityName>
    <RequiredWarehouseEntityName>MTV_System$WorkItem$Activity</RequiredWarehouseEntityName>
    <ManagedTypeViewName>MTV_Microsoft$SystemCenter$Orchestrator$RunbookAutomationActivity</ManagedTypeViewName>
    <Watermark>2015-01-30T08:59:14.397</Watermark>
    </Target>
    </Config>
    If you look carefully you will see that the 1st <target> is missing the ManagedTypeViewName, which when "shredded" by the Staging.GroomDwStagingData returns the following result set
    Example
    DECLARE @Config xml
    DECLARE @GroomingCriteria NVARCHAR(MAX)
    SET @GroomingCriteria = '<Config><Target><ModuleName>TransformActivityDim</ModuleName><WarehouseEntityName>ActivityDim</WarehouseEntityName><RequiredWarehouseEntityName>MTV_System$WorkItem$Activity</RequiredWarehouseEntityName><Watermark>2015-01-30T08:59:14.397</Watermark></Target><Target><ModuleName>TransformActivityDim</ModuleName><WarehouseEntityName>ActivityDim</WarehouseEntityName><RequiredWarehouseEntityName>MTV_System$WorkItem$Activity</RequiredWarehouseEntityName><ManagedTypeViewName>MTV_Microsoft$SystemCenter$Orchestrator$RunbookAutomationActivity</ManagedTypeViewName><Watermark>2015-01-30T08:59:14.397</Watermark></Target></Config>'
    SET @Config = CONVERT(xml, @GroomingCriteria)
    SELECT
    ModuleName = p.value(N'child::ModuleName[1]', N'nvarchar(255)')
    ,WarehouseEntityName = p.value(N'child::WarehouseEntityName[1]', N'nvarchar(255)')
    ,RequiredWarehouseEntityName =p.value(N'child::RequiredWarehouseEntityName[1]', N'nvarchar(255)')
    ,ManagedTypeViewName = p.value(N'child::ManagedTypeViewName[1]', N'nvarchar(255)')
    ,Watermark = p.value(N'child::Watermark[1]', N'datetime')
    FROM @Config.nodes(N'/Config/*') Elem(p)
    /* RESULTS - NOTE THE NULL VALUE FOR ManagedTypeViewName
    ModuleName WarehouseEntityName RequiredWarehouseEntityName ManagedTypeViewName Watermark
    TransformActivityDim ActivityDim MTV_System$WorkItem$Activity NULL 2015-01-30 08:59:14.397
    TransformActivityDim ActivityDim MTV_System$WorkItem$Activity MTV_Microsoft$SystemCenter$Orchestrator$RunbookAutomationActivity 2015-01-30 08:59:14.397
    When the procedure enters the loop to build its dynamic SQL to delete relevant rows from the inbound schema tables it concatenates various options / variables into an executable string. However when adding a NULL value to a string the entire string becomes
    NULL which then gets executed.
    Whilst executing "EXEC(NULL)" would cause SQL to throw an error and be caught, executing the following doesnt
    DECLARE @null_string VARCHAR(100)
    SET @null_string = 'hello world ' + NULL
    EXEC(@null_string)
    SELECT @null_string
    So as it hasnt caused an error the next part of the procedure is to move to the next record and this is why its caught in an infinite loop
    DELETE @items WHERE ManagedTypeViewName = @View
    The value for the variable @View is the ManagedTypeViewName which is NULL, as ANSI_NULLS are set to ON in the connection and not overridded in the procedure then the above statement wont delete anything as it needs to handle NULL values differently (IS NULL),
    so we are now stuck in an infinite loop executing NULL for 2 hours until cancelled.
    I amended the stored procedure and added the following line before the loop statement which had the desired effect and "fixed" the performance issue for the time being
    DELETE @items WHERE ManagedTypeViewName IS NULL
    I also noticed that the following line in dbo.p_GetDwStagingGroomingConfig is commented out (no idea why as no notes in the procedure)
    --AND COALESCE(i.ManagedTypeViewName, j.RelationshipTypeViewName) IS NOT NULL
    There are obviously other ways to mitigate the dynamic SQL string being NULL, there's more than one way to skin a cat and thats not why I am asking this question, but what I am concerned about is that is there a reason that the xml / @GroomingCriteria is incomplete
    and / or that the procedures dont handle potential NULL values.
    I cant find any documentation, KBs, forum posts of anyone else having this issue which somewhat surprises me.
    Would be grateful of any help / advice that anyone can provide or if someone can look at their 2 stored procedures on a later version to see if it has already been fixed. Or is it simply that we have orphaned data, this is the bit that concerns most as I dont
    really want to be deleting / updating data when I have no idea what the knock on effect might be
    Many many thanks
    Andy

    First thing I would do is upgrade to 2012 R2 UR5. If you are running non-US dates you need the UR5 hotfix also.
    Rob Ford scsmnz.net
    Cireson www.cireson.com
    For a free SCSM 2012 Notify Analyst app click
    here

  • Update routine infinite loop

    Hello Experts,
    For loading ODS2 we are making a lookup on ODS1 for 0material based on
    purchaing document number, item line item.
    Is there any mistake in the start routine or update routine.
    Because the load goes in infinite loop. I think update routine should be changed.
    Any suggestions are appreciated
    Start routine:
    data: begin of itab occurs 0,
            pur_doc like /BIC/AZODS100-OI_EBELN,
            item like /BIC/AZODS100-OI_EBELP,
            material like /BIC/AZODS100-material,
          end of itab.
    clear itab.
    select OI_EBELN OI_EBELP MAT_PLANT from /BIC/AZODS100
             into table itab.
    Update routine for 0material
    loop at itab where pur_doc = COMM_STRUCTURE-OI_EBELN
                       and item = COMM_STRUCTURE-OI_EBELP.
           RESULT = itab-matplant.
    endloop.

    Hi,
    this takes a long time, because with each record of your data packaged it is doing the loop and scanning each row of the internal table. Use the following instead.
    Start routine:
    types: begin of t_itab,
    pur_doc like /BIC/AZODS100-OI_EBELN,
    item like /BIC/AZODS100-OI_EBELP,
    material like /BIC/AZODS100-material,
    end of t_itab.
    data: itab type hashed table of t_itab with unique key pur_doc item.
    select OI_EBELN OI_EBELP MAT_PLANT from /BIC/AZODS100
    into table itab order by oi_ebeln oi_ebelp mat_plant.
    I hope these fields are the key of the ods object.
    Update routine for 0material
    data: wa_itab type t_itab.
    read table itab into wa_itab with table key pur_doc = COMM_STRUCTURE-OI_EBELN
    item = COMM_STRUCTURE-OI_EBELP.
    if sy-subrc = 0.
    RESULT = wa_itab-matplant.
    else.
    clear result.
    endif.
    Hope this helps
    regards
    Siggi

  • Infinite loop error after using Java Sun Tutorial for Learning Swing

    I have been attempting to create a GUI following Sun's learning swing by example (example two): http://java.sun.com/docs/books/tutorial/uiswing/learn/example2.html
    In particular, the following lines were used almost word-for-word to avoid a non-static method call problem:
    SwingApplication app = new SwingApplication();
    Component contents = app.createComponents();
    frame.getContentPane().add(contents, BorderLayout.CENTER);I believe that I am accidentally creating a new instance of the gui class repeatedly (since it shows new GUI's constantly and then crashes my computer), possibly because I am creating an instance in the main class, but creating another instance in the GUI itself. I am not sure how to avoid this, given that the tutorials I have seen do not deal with having a main class as well as the GUI. I have googled (a nice new verb) this problem and have been through the rest of the swing by example tutorials, although I am sure I am simply missing a website that details this problem. Any pointers on websites to study to avoid this problem would be appreciated.
    Thanks for your time-
    Danielle
    /** GUI for MicroMerger program
    * Created July/06 at IARC
    *@ author Danielle
    package micromerger;
    import javax.swing.*;
    import java.awt.*;
    import java.awt.event.*;
    import java.io.BufferedWriter;
    import java.io.File;
    import java.io.FileWriter;
    import java.io.IOException;
    import java.io.PrintWriter;
    import javax.swing.JFileChooser;
    import java.lang.Object;
    public class MGui
         private static File inputFile1, inputFile2;
         private static File sfile1, sfile2;
         private static String file1Name, file2Name;
         private String currFile1, currFile2;
         private JButton enterFile1, enterFile2;
         private JLabel enterLabel1, enterLabel2;
         private static MGui app;
         public MGui()
              javax.swing.SwingUtilities.invokeLater(new Runnable()
                   public void run()
                        System.out.println("About to run create GUI method");
                        app = new MGui();
                        System.out.println("declared a new MGui....");
                        createAndShowGUI();
         //initialize look and feel of program
         private static void initLookAndFeel() {
            String lookAndFeel = null;
         lookAndFeel = UIManager.getSystemLookAndFeelClassName();
         try
              UIManager.setLookAndFeel(lookAndFeel);
         catch (ClassNotFoundException e) {
                    System.err.println("Couldn't find class for specified look and feel:"
                                       + lookAndFeel);
                    System.err.println("Did you include the L&F library in the class path?");
                    System.err.println("Using the default look and feel.");
                } catch (UnsupportedLookAndFeelException e) {
                    System.err.println("Can't use the specified look and feel ("
                                       + lookAndFeel
                                       + ") on this platform.");
                    System.err.println("Using the default look and feel.");
                } catch (Exception e) {
                    System.err.println("Couldn't get specified look and feel ("
                                       + lookAndFeel
                                       + "), for some reason.");
                    System.err.println("Using the default look and feel.");
                    e.printStackTrace();
         // Make Components--
         private Component createLeftComponents()
              // Make panel-- grid layout
         JPanel pane = new JPanel(new GridLayout(0,1));
            //Add label
            JLabel welcomeLabel = new JLabel("Welcome to MicroMerger.  Please Enter your files.");
            pane.add(welcomeLabel);
         //Add buttons to enter files:
         enterFile1 = new JButton("Please click to enter the first file.");
         enterFile1.addActionListener(new enterFile1Action());
         pane.add(enterFile1);
         enterLabel1 = new JLabel("");
         pane.add(enterLabel1);
         enterFile2 = new JButton("Please click to enter the second file.");
         enterFile2.addActionListener(new enterFile2Action());
         pane.add(enterFile2);
         enterLabel2 = new JLabel("");
         pane.add(enterLabel2);
         return pane;
         /** Make GUI:
         private static void createAndShowGUI()
         System.out.println("Creating a gui...");
            JFrame.setDefaultLookAndFeelDecorated(true);
            //Create and set up the window.
            JFrame frame = new JFrame("MicroMerger");
            frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
         //Add stuff to the frame
         //MGui app = new MGui();
         Component leftContents = app.createLeftComponents();
         frame.getContentPane().add(leftContents, BorderLayout.WEST);
            //Display the window.
            frame.pack();
            frame.setVisible(true);
    private class enterFile1Action implements ActionListener
         public void actionPerformed(ActionEvent evt)
              JFileChooser chooser = new JFileChooser();
              int rVal = chooser.showOpenDialog(enterFile1);
              if(rVal == JFileChooser.APPROVE_OPTION)
                   inputFile1 = chooser.getSelectedFile();
                   PrintWriter outputStream;
                   file1Name = inputFile1.getName();
                   enterLabel1.setText(file1Name);
    private class enterFile2Action implements ActionListener
         public void actionPerformed(ActionEvent evt)
              JFileChooser chooser = new JFileChooser();
              int rVal = chooser.showOpenDialog(enterFile1);
              if(rVal == JFileChooser.APPROVE_OPTION)
                   inputFile2 = chooser.getSelectedFile();
                   PrintWriter outputStream;
                   file2Name = inputFile2.getName();
                   enterLabel2.setText(file2Name);
    } // end classAnd now the main class:
    * Main.java
    * Created on June 13, 2006, 2:29 PM
    * @author Danielle
    package micromerger;
    import java.awt.*;
    import java.awt.event.*;
    import javax.swing.*;
    import java.io.*;
    public class Main
        /** Creates a new instance of Main */
        public Main()
         * @param args the command line arguments
        public static void main(String[] args)
            MGui mainScreen = new MGui();
            //mainScreen.setVisible(true);
            /**Starting to get file choices and moving them into GPR Handler:
             System.out.println("into main method");
         String file1Name = new String("");
             file1Name = MGui.get1Name();
         System.out.println("good so far- have MGui.get1Name()");
        }// end main(String[] args)
    }// end class Main

    um, yeah, you definitely have a recursion problem, that's going to create an infinite loop. you will eventually end up an out of memory error, if you don't first get the OS telling you you have too many windows. interestingly, because you are deferring execution, you won't get a stack overflow error, which you expect in an infinite recursion.
    lets examine why this is happening:
    in main, you call new MGui().
    new MGui() creates a runnable object which will be run on the event dispatch thread. That method ALSO calls new MGui(), which in turn ALSO creates a new object which will be run on the event dispatch thead. That obejct ALSO calls new MGui(), which ...
    well, hopefully you get the picture.
    you should never unconditionally call a method from within itself. that code that you have put in the constructor for MGui should REALLY be in the main method, and the first time you create the MGui in the main method as it currently exists is unnecessary.
    here's what you do: get rid of the MGui constructor altogether. since it is the implicit constructor anyway, if it doesn't do anything, you don't need to provide it.
    now, your main method should actually look like this:
    public static void main( String [] args ) {
      SwingUtilities.invokeLater( new Runnable() {
        public void run() {
          MGui app = new MGui();
          app.createAndShowGUI();
    }// end mainyou could also declare app and call the constructor before creating the Runnable, as many prefer, because you would have access to it from outside of the Runnable object. The catch there, though, is that app would need to be declared final.
    - Adam

Maybe you are looking for

  • List Item problem in oracle forms

    Hi, I am using list item in oracle forms 6i and facing one problem. I am populating list using following built-in. Clear_list() Create_Group_From_Query( ) Populate_list() The problem I am facing is when list gets populate it keep the cursor at last e

  • Reading uploaded file from app. server

    Hi All, I am trying to upload a .csv format file to app. server thru txn CG3Z.... When i try to open the file in my code thru open dataset and read dataset ...it is giving it in the form of  30002058,1000#50055501,2000# Now i want it to be in 3000205

  • HT1476 iPhone charges on dock connected to laptop but not dock connected to wall charger

    I used to charge my iPhone at night connected to a wall charger.  Sometimes I would get an inverted yellow triangle with the message that the device di not support charging, but it would still charge. Now for some reason it gives the message and real

  • User_cons_columns return no Result

    Hi, I have created the table through following query CREATE TABLE Product P_Id char(6), P_Name varcahr2(15), P_Price Number CONSTRAINT Prduct_P_Id PRIMARY KEY (P_Id)Tablespace STORE; Table created successfully When I want to view constraint using fol

  • How can I add the signals produced by two signal generators

    I have created two signal generators, I need to add the two values, multiply them by a constant, and sum the values of the signals over a period of time. What is the best way to do this? I can't even get the two signals to sum. It tells me that the t