zoukankan      html  css  js  c++  java
  • 善用Axapta当中的exists join和inner join

    其实我也发现这个问题了,

    但是Junevoful已经说的很详细了,我就补充两点:

    1,使用exists join不可以引用第二个表的数据,表示÷这条数据一旦存在于第二个表中,就认为满足条件,但是使用inner join可以引用第二个表的数据,是内关联。

    2,大家可以使用Axapta本省带的Sql性能监视器来监视Sql语句的执行效率,启动的方法是:

     

     

    下面我就引用一下Junevoful的文章,他说的很详细,也很精彩,谢谢他给我带了这么好的文章!

     

    前几天,在做系统优化的时候,居然发现代码当中存在while嵌套循环语句

    while select table 1

    {

    ..

    while select table2

    以前并不太在意,但是既然要系统优化,就只怕没找到东西可以改的。

    突然忽发奇想,何不测试一下这样做的系统开销有多大呢?于是写了三个job,进行测试

    static void TestInnerJoinUsingWhile(Args _args)

    {

           ...

           ;

           startTime = WinApi::getTickCount();

           while select ledgerTrans

           where ledgerTrans.AccountNum == accountNum &&

           ((ledgerTrans.TransDate >= 1/7/2005 &&

           ledgerTrans.TransDate <= 31/7/2005))

           {

           while select projTransPosting

           where projTransPosting.Voucher == ledgerTrans.voucher &&

           projTransPosting.Account == accountNum

           {

           ...

           tmpFRD_LedgerDriDwnContractDtls.insert();

     

           }

           }

           endTime = WinApi::getTickCount();

           duration = endTime - startTime;

           Info(int2str(duration));

    }

     

    static void TestInnerJoinUsingJoin(Args _args)

    {

           while select ledgerTrans

           where ...

           join projTransPosting

           where ...

    }

     

    static void TestExistsJoinUsingJoin(Args _args)

    {

           ...

           while select ledgerTrans

           where ...

           exists join projTransPosting

           where ...

    }

    结果发现使用嵌套while的时间是4012微秒,Inner join1986微秒,exists join1689微秒。

    可见在写代码的时候,还是需要按照Best Practice的要求,这样才能获得最好的performance

  • 相关阅读:
    Hadoop学习之编译eclipse插件
    js堆栈溢出错误
    java——推断日期是否在今天之前
    AlertDialog.Builder中的setMultiChoiceItems中的事件处理
    Qemu之Network Device全虚拟方案二:虚拟网卡的创建
    【Android Tricks 6】ViewPager首页与尾页的滑动动作响应
    JFinal开发web项目出现故障小记
    HDU-4407-Sum(容斥原理)
    自己动手写CPU之第五阶段(3)——MIPS指令集中的逻辑、移位与空指令
    待字闺中之巧妙排序分析:
  • 原文地址:https://www.cnblogs.com/Fandyx/p/2761586.html
Copyright © 2011-2022 走看看