Search code examples
sqlsql-serverarithabort

In SQL Server, always activate Arithabort, recommended?


I have had this doubt for a long time and no matter how much I read and search for information I can't find anything clear. For example, this web site recommends it: https://blog.sqlauthority.com/2018/08/07/sql-server-setting-arithabort-on-for-all-connecting-net-applications/

I have activated Arithabort several times in SQL Server and sometimes I have positive and sometimes negative results.

In short, is it recommended to always activate the Arithabort in SQL Server?


Solution

  • In short, is it recommended to always activate the Arithabort in SQL Server?

    Yes. Per the documentation:

    Always set ARITHABORT to ON in your logon sessions. Setting ARITHABORT to OFF can negatively impact query optimization, leading to performance issues.

    Furthermore, the option must be ON to use features like indexes on computed columns, indexed views, filtered indexes, etc.

    You don't necessarily need to set ARITHABORT ON explicitly or with instance-wide configuration because modern client APIs set ANSI WARNINGS ON by default so it will already be set implicitly for databases in 90 (SQL Server 2005) or later compatibility mode. Note that SQL Server 2008 was the last version to support compatibility level 80. Also from the doc:

    When ANSI_WARNINGS has a value of ON and the database compatibility level is set to 90 or higher then ARITHABORT is implicitly ON regardless of its value setting. If the database compatibility level is set to 80 or earlier, the ARITHABORT option must be explicitly set to ON.