What is faster on MSSQL: Calcsums or Calcfields?

deblockerdeblocker Member Posts: 19
Anyone has done some comparison tests about that?
Like in the example of Mark Brummel posted Fri the Nov 04, 2005, if boths the flowfield and sumindex are related to the same result, what is faster?

Comments

  • ara3nara3n Member Posts: 9,257
    flowfields uses sumindex fields. they would work the same way.
    Ahmed Rashed Amini
    Independent Consultant/Developer


    blog: https://dynamicsuser.net/nav/b/ara3n
  • Marije_BrummelMarije_Brummel Member, Moderators Design Patterns Posts: 4,262
    Both flowfields and calcsums use the SIFT tables.

    You only need to use calcsums if you want to filter in a piece of code.

    What is the exact situation you are facing?
  • deblockerdeblocker Member Posts: 19
    I mean, if there could be a performance gain on MSSQL usig either Calcsums or Calcfields...
  • DenSterDenSter Member Posts: 8,307
    I don't think there'd be a performance gain, because they both use the same technology. A Flowfield is calculated using CALCSUMS behind the scenes, it uses the same SIFT technology.

    Of course it could be possible that CALCFIELDS uses some really efficient version of SIFT that we can't get to, but I really doubt there's a big performance difference.
  • Marije_BrummelMarije_Brummel Member, Moderators Design Patterns Posts: 4,262
    Just do a test with the client monitor. You will see if there is a difference.

    With the clientmonitor you can see the SQL queries.

    Let us know the results.
  • jreynoldsjreynolds Member Posts: 175
    I'm not sure how it works with SQL but with the Navision database I believe that CALCFIELDS will use the first key that can statisfy the request, while with CALCSUMS you can control which key is used.
  • Marije_BrummelMarije_Brummel Member, Moderators Design Patterns Posts: 4,262
    jreynolds wrote:
    I'm not sure how it works with SQL but with the Navision database I believe that CALCFIELDS will use the first key that can statisfy the request, while with CALCSUMS you can control which key is used.

    Yes this is true!

    I remember changing the order of the keys for making flowfields work! Imagine that.

    So that is

    Flowfields - Calcsums

    0 - 1
    :mrgreen:
  • bbrownbbrown Member Posts: 3,268
    When you do a CalcFields on a FlowField, Navision actually executes a CalcSums on the underlying table. It uses the first key that contains all the fields being filtered in the FlowField definition. If the same key and filters are specified, I would expect little or no performance difference between the two.

    You can influence the key used by adding filters to the FlowField defintion.

    With SQL, this key may or may not be the index that is used to retrieve the data.
    There are no bugs - only undocumented features.
Sign In or Register to comment.