SET Options - 1

  • Thank you Hugo.

    (At least it wasn't something obvious I just wasn't seeing.)

  • Good question, learned something today. Didn't think a numeric related setting would effect an action relating to textual information, oh well.

    Thanks,

    Lon

  • Thanks Ron. Very informative today.

    Jason...AKA CirqueDeSQLeil
    _______________________________________________
    I have given a name to my pain...MCM SQL Server, MVP
    SQL RNNR
    Posting Performance Based Questions - Gail Shaw[/url]
    Learn Extended Events

  • Great question. Got a little education today. Thanks.

    Rob Schripsema
    Propack, Inc.

  • Koen Verbeeck (12/14/2012)


    Great question to end the week. Had to do some research, but it was worth it.

    I agree... the research as to the various set options was worth the time.



    --Mark Tassin
    MCITP - SQL Server DBA
    Proud member of the Anti-RBAR alliance.
    For help with Performance click this link[/url]
    For tips on how to post your problems[/url]

  • Toreador (12/14/2012)


    Thanks for the easy question to end the week!

    😉

    Hey, what did I tell you??!!! >>>SMACK<<<

    😀

    ron

    -----
    a haiku...

    NULL is not zero
    NULL is not an empty string
    NULL is the unknown

  • Nice question.

  • Ron, you made me scratch my head a lot... Thanks!

  • Hugo Kornelis (12/14/2012) -

    The reason for this limitation? (Puts on speculative hat) Many settings are discouraged anyway, and I guess that MS decided not to put in extra engineering effort to support and test indexed views (and several other features with similar limitations) under all those settings. So they simply forbid them.

    Now I understand why speculation is considered a negative speech pattern.

    Hugo, If you take a look at the SQL documentation the reason is clear.

    Even if an expression is deterministic, if it contains float expressions, the exact result may depend on the processor architecture or version of microcode. To ensure data integrity, such expressions can participate only as non-key columns of indexed views. Deterministic expressions that do not contain float expressions are called precise. Only precise deterministic expressions can participate in key columns and in WHERE or GROUP BY clauses of indexed views.

    How would the database engine test the values of an indexed view for the right data percision when executing or running the TSQL from a client if that client connection has the SET option ARITHABORT turned ON?

    Apparently this has nothing to do with the testing practices of MS Engineers. 😛

    More likely it is the testing done by the Database Engine to data and columns that are to be included in the indexed view.

    In this specific example it is the testing of the data being inserted into a column that is participating in the indexed view.

    All of the above need to check the percision of the Data Types and that requires SET ARITHABORT OFF and several other OFF

    When creating and manipulating indexes on computed columns or indexed views, the SET options ARITHABORT, CONCAT_NULL_YIELDS_NULL, QUOTED_IDENTIFIER, ANSI_NULLS, ANSI_PADDING, and ANSI_WARNINGS must be set to ON. The option NUMERIC_ROUNDABORT must be set to OFF.

    If any of these options are not set to the required values, INSERT, UPDATE, and DELETE actions on indexed views or tables with indexes on computed columns will fail. SQL Server will raise an error listing all the options that are incorrectly set. Also, SQL Server will process SELECT statements on these tables or indexed views as though the indexes on computed columns or on the views do not exist.

    http://msdn.microsoft.com/en-us/library/aa259205(v=sql.80).aspx

    Like my grandfather always said; "You are served better by knowing how to read than how to write." 😎

  • Excellent question.

    Tom

  • SanDroid, your explanation has me puzzled. The first quote says that one cannot use an expression containing a float expression in the key column of an indexed view. By itself, this would appear not to apply to the QOD situation where the index is based on an INT column. How then is this a clear explanation for prohibiting the use of an index on a view if Numeric_RoundAbort is On? Wouldn't that setting only affect the evaluation of an expression that depended on a float or other expression that's not strictly deterministic at the lowest (machine) level?

    The second part of your explanation didn't help me any more than the first. You pose an apparently rhetorical question, "How would the database engine test the values of an indexed view for the right data percision when executing or running the TSQL from a client if that client connection has the SET option ARITHABORT turned ON?" I don't follow why that setting (or NUMERIC_ROUNDABORT turned OFF as I think you may have meant) would affect what the engine would do with an INT column.

    Your final paragraph actually echoes Hugo when you say it seems likely the engine would have to test the absolute deterministic characteristics of all components of the view index. If I may take that thought forward, wouldn't that mean the engine instead just says "if NUMERIC_ROUNDABORT is OFF, then non-deterministic values COULD be there, and I don't want to go looking for that possibility deep down inside". This would be how I understood Hugo's speculation, back where we started. Can this be cleared up WITHOUT speculation?

  • Argh!

    I did read the docs, but I got too focused on the index creation itself, which will fail if numeric_roundabort is on, but the info on update/insert etc. didn't really sink in.

    Thank you for the question.

  • I love indexed views

    Actually I hate indexed views

    Actually I love indexed views

    Actually I hate indexed views

    Actually I love indexed views

    Actually I hate indexed views

    Actually I love indexed views

    Actually I hate indexed views

    Actually I love indexed views

    etc etc etc.

    Actually, they are good sometimes but seldom worth the effort 🙂

    David Bridge
    David Bridge Technology Limited
    www.davidbridgetechnology.com

  • Learnt something new...

  • john.arnott (12/15/2012)


    SanDroid, your explanation has me puzzled. The first quote says that one cannot use an expression containing a float expression in the key column of an indexed view. By itself, this would appear not to apply to the QOD situation where the index is based on an INT column. How then is this a clear explanation for prohibiting the use of an index on a view if Numeric_RoundAbort is On? Wouldn't that setting only affect the evaluation of an expression that depended on a float or other expression that's not strictly deterministic at the lowest (machine) level?

    The second part of your explanation didn't help me any more than the first. You pose an apparently rhetorical question, "How would the database engine test the values of an indexed view for the right data percision when executing or running the TSQL from a client if that client connection has the SET option ARITHABORT turned ON?" I don't follow why that setting (or NUMERIC_ROUNDABORT turned OFF as I think you may have meant) would affect what the engine would do with an INT column.

    Your final paragraph actually echoes Hugo when you say it seems likely the engine would have to test the absolute deterministic characteristics of all components of the view index. If I may take that thought forward, wouldn't that mean the engine instead just says "if NUMERIC_ROUNDABORT is OFF, then non-deterministic values COULD be there, and I don't want to go looking for that possibility deep down inside". This would be how I understood Hugo's speculation, back where we started. Can this be cleared up WITHOUT speculation?

    Thanks for writing this so I didn't have to 🙂

Viewing 15 posts - 16 through 30 (of 32 total)

You must be logged in to reply to this topic. Login to reply