Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
 
 
 
        
Home       Members    Calendar    Who's On


Add to briefcase «««123

Creating indexes on computed columns Expand / Collapse
Author
Message
Posted Thursday, September 30, 2010 7:33 AM
SSChasing Mays

SSChasing MaysSSChasing MaysSSChasing MaysSSChasing MaysSSChasing MaysSSChasing MaysSSChasing MaysSSChasing Mays

Group: General Forum Members
Last Login: Tuesday, December 16, 2014 7:59 AM
Points: 649, Visits: 478
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.


Post #995925
Posted Thursday, September 30, 2010 7:50 AM
SSCrazy

SSCrazySSCrazySSCrazySSCrazySSCrazySSCrazySSCrazySSCrazy

Group: General Forum Members
Last Login: Tuesday, October 7, 2014 2:56 AM
Points: 2,842, Visits: 3,876
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
Post #995942
Posted Thursday, September 30, 2010 7:55 AM
SSC Veteran

SSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC Veteran

Group: General Forum Members
Last Login: Friday, April 18, 2014 6:40 AM
Points: 297, Visits: 18
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,
Post #995949
Posted Thursday, September 30, 2010 8:45 AM
SSC-Enthusiastic

SSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-Enthusiastic

Group: General Forum Members
Last Login: Monday, November 17, 2014 1:56 PM
Points: 192, Visits: 217
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.
Post #995994
Posted Thursday, September 30, 2010 9:22 AM


SSC-Dedicated

SSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-Dedicated

Group: Administrators
Last Login: Yesterday @ 10:36 AM
Points: 31,362, Visits: 15,823
The answer choices have been corrected and points awarded back.







Follow me on Twitter: @way0utwest

Forum Etiquette: How to post data/code on a forum to get the best help
Post #996030
Posted Thursday, September 30, 2010 12:17 PM
Old Hand

Old HandOld HandOld HandOld HandOld HandOld HandOld HandOld Hand

Group: General Forum Members
Last Login: Wednesday, April 30, 2014 11:35 AM
Points: 311, Visits: 284
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?

Post #996150
Posted Thursday, September 30, 2010 6:40 PM


SSCoach

SSCoachSSCoachSSCoachSSCoachSSCoachSSCoachSSCoachSSCoachSSCoachSSCoachSSCoach

Group: General Forum Members
Last Login: Today @ 7:07 AM
Points: 18,060, Visits: 16,094
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
Post #996354
Posted Friday, October 1, 2010 2:05 PM


SSCertifiable

SSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiable

Group: General Forum Members
Last Login: Yesterday @ 5:50 PM
Points: 7,923, Visits: 9,649
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
Post #996989
Posted Thursday, January 5, 2012 12:59 AM
SSCrazy

SSCrazySSCrazySSCrazySSCrazySSCrazySSCrazySSCrazySSCrazy

Group: General Forum Members
Last Login: Tuesday, December 16, 2014 1:21 PM
Points: 2,102, Visits: 540
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
Post #1230526
« Prev Topic | Next Topic »

Add to briefcase «««123

Permissions Expand / Collapse