Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 583561
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T14:48:21+00:00 2026-05-13T14:48:21+00:00

I’m going to do an indexed view, based on three tables with inner and

  • 0

I’m going to do an indexed view, based on three tables with inner and outer joins between them (SQL Server 2005). I will run all kind of queries against this view.
So, I wonder what is the best way to choose which index to be clustered. What are the criteria or is there any tools to help me around.

(Sorry if my question is dull, I don’t have a lot of experience in designing databases).

Thanks in advance!

EDIT: I should make clarification here, that the tables I use in the view are with very intense use and any overhead I take for maintenance of the indexes, should be paid-off.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-13T14:48:22+00:00Added an answer on May 13, 2026 at 2:48 pm

    Since it’s an index, you have to pick a column (or set of columns) which is guaranteed to be non-null and unique in all cases. That’s the biggest and most stringent criteria – anything that might be NULL or duplicate is out of the question right from the get-go.

    Depending on the type of queries you’ll be running on this indexed view, you might also want to see if you have any columns (e.g. a DATE or something) that you’ll be running range queries against. That might make an interesting candidate for a clustering key.

    But the main thing is: your clustering key must be unique and non-null in any circumstance. And in my personal experience, to reduce index size (and thus increase the number of entries per page), I’d try to use as small a key as possible – a single INT is best, or a combination of two INTs – or possibly a GUID – but don’t use VARCHAR(500) fields in your clustering key!

    UPDATE: to all those poster who keep telling us clustered indexes don’t need to be unique – check out what the “Queen of Indexing”, Kimberly Tripp, has to say on the topic:

    Let’s start with the key things that I
    look for in a clustering key:

    * Unique
    * Narrow
    * Static
    

    Why Unique?
    A clustering key should be
    unique because a clustering key (when
    one exists) is used as the lookup key
    from all non-clustered indexes. Take
    for example an index in the back of a
    book – if you need to find the data
    that an index entry points to – that
    entry (the index entry) must be unique
    otherwise, which index entry would be
    the one you’re looking for? So, when
    you create the clustered index – it
    must be unique. But, SQL Server
    doesn’t require that your clustering
    key is created on a unique column. You
    can create it on any column(s) you’d
    like. Internally, if the clustering
    key is not unique then SQL Server will
    “uniquify” it by adding a 4-byte
    integer to the data.
    So if the
    clustered index is created on
    something which is not unique then not
    only is there additional overhead at
    index creation, there’s wasted disk
    space, additional costs on INSERTs and
    UPDATEs, and in SQL Server 2000,
    there’s an added cost on a clustereD
    index rebuild (which because of the
    poor choice for the clustering key is
    now more likely).

    Source: http://www.sqlskills.com/blogs/kimberly/post/Ever-increasing-clustering-key-the-Clustered-Index-Debateagain!.aspx

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

link Im having trouble converting the html entites into html characters, (&# 8217;) i
In order to apply a triggered animation to all ToolTip s in my app,
Seemingly simple, but I cannot find anything relevant on the web. What is the
Does anyone know how can I replace this 2 symbol below from the string
this is what i have right now Drawing an RSS feed into the php,
I'm trying to decode HTML entries from here NYTimes.com and I cannot figure out
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I have just tried to save a simple *.rtf file with some websites and
I want to count how many characters a certain string has in PHP, but
I ran into a problem. Wrote the following code snippet: teksti = teksti.Trim() teksti

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.