Note that there are some explanatory texts on larger screens.

plurals
  1. POWhy this Query takes such a long time to execute
    primarykey
    data
    text
    <p>I have three tables </p> <ul> <li>glSalesJournal</li> <li>HMISAdd</li> <li>HMISMain</li> </ul> <p>Now what i am trying to do is add the glSalesJournal amt with HMISAdd amt while grouping up with various Fields and inserting the result into glSalesJournal</p> <p>The glSalesJournal contains 633173 records</p> <p>The HMISAdd contains 4193 records</p> <p>HMISAdd and glSalesJournal contains the same columns which are</p> <ul> <li>loc</li> <li>glAcct</li> <li>glSubAcct</li> <li>batchNbr</li> <li>contractNbr</li> <li>amt</li> </ul> <p>I added indexes to the table still the results are the same.</p> <p>Here is my code:</p> <pre><code>INSERT INTO hmismain (loc, glacct, subacct, batchnbr, contractnbr, amt) SELECT glsalesjournal.loc, glsalesjournal.glacct, glsalesjournal.glsubacct, ( glsalesjournal.amt + hmisadd.amt ) AS sumAmt, glsalesjournal.batchnbr, glsalesjournal.salescontnbr FROM glsalesjournal LEFT OUTER JOIN hmisadd ON ( glsalesjournal.loc = hmisadd.loc AND glsalesjournal.glacct = hmisadd.glacct AND glsalesjournal.glsubacct = hmisadd.subacct AND glsalesjournal.batchnbr = hmisadd.batchnbr AND glsalesjournal.salescontnbr = hmisadd.contractnbr ) GROUP BY glsalesjournal.loc, hmisadd.loc, glsalesjournal.glacct, hmisadd.glacct, glsalesjournal.glsubacct, hmisadd.subacct, glsalesjournal.batchnbr, hmisadd.batchnbr, glsalesjournal.salescontnbr, hmisadd.contractnbr </code></pre> <p>The time taken by the script to execute is more than 2 hours. Even when I limit the Records to 100 the time taken is the same. </p> <p>Can someone please guide me how can I optimize the script.</p> <p>Thanks</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload