Creating indexes on computed columns

  • "Me too" on the incorrect options stuff.

    But in any case, 1 point is a bit mean for a 4-checkbox multiselect question

  • Manie:

    Your answers are wrong. You state that you can pull data from multiple rows, yet BOL which you state as your reference says

    No column reference pulls data from multiple rows. For example, aggregate functions such as SUM or AVG depend on data from multiple rows and would make a computed_column_expression nondeterministic.

    Can't have it both ways.

    Steve Jimmo
    Sr DBA
    “If we ever forget that we are One Nation Under God, then we will be a Nation gone under." - Ronald Reagan

  • Very disappointing. This is a fairly basic question. A little proofreading could have prevented this from becoming a bad question.

  • Actually, if you read carefully, an index on a computed column CAN include multiple rows and columns from other tables. As long as one of the following four conditions are true, then you can use the computed column in an index. Therefore, only the first answer is necessary and the other three are incorrect answers.

    The computed_column_expression must be deterministic. A computed_column_expression is deterministic when one or more of the following is true:

    All functions that are referenced by the expression are deterministic and precise. These functions include both user-defined and built-in functions. For more information, see Deterministic and Nondeterministic Functions. Functions might be imprecise if the computed column is PERSISTED. For more information, see Creating Indexes on Persisted Computed Columns later in this topic.

    All columns that are referenced in the expression come from the table that contains the computed column.

    No column reference pulls data from multiple rows. For example, aggregate functions such as SUM or AVG depend on data from multiple rows and would make a computed_column_expression nondeterministic.

    Has no system data access or user data access.


    Steve Eckhart

  • I don't mind getting a question wrong, but only when the answer i give is the wrong one. The third choice is clearly incorrect as true when read in BOL.

  • Please check the answers before posting a question. People use the QofD as a way to learn or to refresh the memory on a given topic. Bad and incorrect questions just waste time.

  • Hi Steve,

    Steve Eckhart (9/30/2010)


    Actually, if you read carefully, an index on a computed column CAN include multiple rows and columns from other tables.

    Can you give an example of multiple rows? I doubt it.

    And for the columns from other tables -> That is per definition non-deterministic.

    http://msdn.microsoft.com/en-us/library/aa214775(SQL.80).aspx

    As long as one of the following four conditions are true, then you can use the computed column in an index.

    Now that does not say "exactly" one, it means one or more. It does not tell you which combinations would be deterministic and precise.

    Best Regards,

    Chris Büttner

  • Hi,

    As others did, I have selected choices 1,2 and 4 and left 3 unchecked. If this is wrong then MSDN itself wrong. Please refer the link

    http://msdn.microsoft.com/en-us/library/ms189292.aspx

    I am not responding to gain the point, but to get exactly which is correct answer.

    Regards,

  • No column reference pulls data from multiple rows. For example, aggregate functions such as SUM or AVG depend on data from multiple rows and would make a computed_column_expression nondeterministic.

  • The answer choices have been corrected and points awarded back.

  • Just wonder about user data meaning. If I have user defined table it means that it keeps user defined data.

    Here the very simple example of filtered index on computed column

    CREATE TABLE [dbo].[t2](

    [c2] [int] NULL,

    [comp_col] AS ([c2]*(2)) PERSISTED

    ) ON [PRIMARY]

    GO

    create index ix_comp_col on t2 ( comp_col )

    where c2 > 4

    GO

    So?

  • Steve Jones - Editor (9/30/2010)


    The answer choices have been corrected and points awarded back.

    Thanks for fixing that - for those of us answering late.

    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

  • Two interesting things here:

    The first is that the BoL page referenced in the explanation has incorrect information on it: it quite clearly says

    A computed_column_expression is deterministic when one or more of the following is true:

    where actually all need to true, not just one.

    The second is that the corrected answer may still be wrong: as someone pointed out in an earlier comment, the BoL page says (twice) that a computed column which is imprecise can be used in an index provided it is persisted. So perhaps item 1 should not be in the list of answers to be checked.

    Tom

  • There is error. Correcty answer is 1 and 2. But 4 "Has no system data access or user data access." is correct when computed column marks as persisted and based on function, that will not have access to user/system tables.

    Does question "Creating indexes on computed columns" contain any about persisted ? - No.... I don't won 1 point.

    MS SQL 2008 MCITP x 3
    MS SQL 2012 MCSE x 2

Viewing 14 posts - 16 through 28 (of 28 total)

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