Simple Lock Question

matias_jaurematias_jaure Member Posts: 157
In Navision Manual says that when you use INSERT, MODIFY or DELETE using SQL Server option, only one record is locked. Is it valid even if the option "always rowlock" is not set TRUE?

Thanks for your time,
Matias

Comments

  • strykstryk Member Posts: 645
    The feature "Always Rowlock" just adds the Qury Hint ROWLOCK.
    Anyway, SQL Server will alwys start to lock on the lowest possible granularity - record level.

    By default SQL Server is able to escalate the locking granularity, e.g. replacing Row-Locks by Range-locks, etc.. The hint ROWLOCK prevents this lock-escaltion; which coould be good or bad (depends).

    Hence, even with "Always Rowlock = FALSE" SQL Server will firstly just lock on row-level. Then it depend on the transaction/process if these locks are escalated or not.

    Even more important is the usage of LOCKTABLE or FINDSET(TRUE): These commands set the TRANSACTION ISOLATION LEVEL to SERIALIZABLE, means isolating the current transaction from others.
    Regardless the setting of "Always Rowlock", here the complete range will be serialized, which could cause blocking conflicts ...

    Regards,
    Jörg
    Jörg A. Stryk (MVP - Dynamics NAV)
    NAV/SQL Performance Optimization & Troubleshooting
    STRYK System Improvement
    The Blog - The Book - The Tool
  • matias_jaurematias_jaure Member Posts: 157
    I have another doubt, Navision Manual tells that the Table Transactions are automatically managed by Navision. How this transactions are managed? I mean, an entire codeunit? a function? or what?
  • strykstryk Member Posts: 645
    Hmmm ... I'm not sure what you mean by " Table Transactions are automatically managed" ... could you please tell me from which manual you've got this?
    Jörg A. Stryk (MVP - Dynamics NAV)
    NAV/SQL Performance Optimization & Troubleshooting
    STRYK System Improvement
    The Blog - The Book - The Tool
  • kinekine Member Posts: 12,562
    Whole "Process run" is a one transaction untill Error or Commit function is called or the process run ends. Because NAV is event driven, each event start new transaction and ends when the trigger ends. You can explicitly commit the transaction or rollback it by Error.
    Kamil Sacek
    MVP - Dynamics NAV
    My BLOG
    NAVERTICA a.s.
Sign In or Register to comment.