• GilaMonster (3/4/2013)


    dembones79 (3/4/2013)


    Should the region and district columns be included in the unique clustered index of the view?

    Bear in mind that a clustered index implicitly includes all the columns in the table/view. For the key I'd specify the minimum of columns, just what is the unique portion. The rest of the columns are in the index too.

    If it were a nonclustered index I'd still put just the unqiue columns in the key, the others would be include columns.

    If you (almost) always select by multiple columns, and depending on the selectivity of the columns, you might get significant gains from including another column in the clus index. Don't follow too simplistic rules of "(always) one column per clus index" at the expense of the genuine performance of your dbs.

    Look at some of MS's system tables: some of their internal replication tables have 5 clus keys. I'm sure some would sorely disapprove of that, but it might be needed for best performance.

    SQL DBA,SQL Server MVP(07, 08, 09) A socialist is someone who will give you the shirt off *someone else's* back.