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

  • SEARCH
  • Home
  • 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 8092475
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T20:17:27+00:00 2026-06-05T20:17:27+00:00

Consider a fact table of the form: CREATE TABLE Fact1 ( Dim1 int NOT

  • 0

Consider a fact table of the form:

CREATE TABLE Fact1
(
    Dim1 int NOT NULL,
    Dim2 int NOT NULL,
    Dim3 int NOT NULL,
    Data1 int NOT NULL,
    Data2 int NOT NULL
    ...
)

Fact1 has a single column index on each of the dimensions. Dim1 is assumed to be the time dimension with a granularity down to range of hours (e.g. between 2 PM and 6 PM on March 12 2011). Would it be useful to include Dim2 and Dim3 as covering columns within Dim1? Or likewise on any of them?

More generally, would it ever be useful to include the other dimension table FK columns as a covering column on an index for a given dimension?

Note: For the fact table, we are assuming there is no need to uniquely identify a given fact. Hence, the lack of a primary key or surrogate key. The uniqueness is guaranteed by (Dim1, Dim2, Dim3) always being a unique tuple.

  • 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-06-05T20:17:28+00:00Added an answer on June 5, 2026 at 8:17 pm

    I’m going to try to answer the more general question – “Would it ever be useful to include the other dimension table FK columns as a covering column on an index for a given dimension?”

    Yes. If you have a significant number of queries which do things such as COUNT(), where a covering index allows you to scan a smaller data set, then adding those other dimensions may be valuable.

    SELECT Dim1, Dim2, count(*)
    from Fact1
    group by Dim1, Dim2
    

    With an index on only Dim1 or only Dim2, you end up having to do a FTS to do this count. This may be perfectly fine. Full scans are not always bad. However, if you want to speed up these sorts of queries (say the fact table is very wide), then adding a B-tree index on Dim1, Dim2 would allow the DBMS to go to the index to count, instead of having to go to the table to count. Note that it still will do a full scan of the index which may be only marginally faster than a full table scan.

    In general, I doubt you would see that much of a performance gain since you are still scanning all the rows of the index anyway, and unless the index was significantly smaller than the table you’re probably not going to get a big improvement.

    Since it’s a fact table, the only queries where covering indexes on dimensions will help is when it’s only the dimensions themselves are being queried. Anything that uses the facts will require an index scan, then a lookup in the table for the actual data.

    I would probably just build your B-tree indexes on the dims for queries that use the keys (and joins) and then add additional ones as needed when the system has been running for awhile and common queries have been identified.

    The other case that I can think of where a “covering” index such as this may help speed up queries is when you have queries that are focusing on the a specific dimension combination, and you only want those specific rows.

    SELECT Dim1, Dim2, Data1, Data2
      FROM Fact1 
     WHERE Dim1 = @A and Dim2 = @B;
    

    You may see a very slight performance gain if you have a b-tree index on Dim1, Dim2 rather than just Dim1, since you scan the index for all of the items in the WHERE clause, and then get your fact data.

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

Sidebar

Related Questions

This is a FACT Table in a Data Warehouse It has a composite index
Possible Duplicate: else or return? Consider a typical recursive function: public int Fact(n) {
Consider a grocery store scenario (I'm making this up) where you have FACT records
Consider the table of events below. The OrderID field is a foreign key to
EDIT: This isn't as trivial as you think. Consider the fact that each addition
Consider the following table with a constraint that's a bit daft but simple enough
I realize that referring to these as dimension and fact tables is not exactly
Consider the following table in SQL Server 2008: LanguageCode varchar(10) Language nvarchar(50) LanguageCode participates
Consider the following table tweets --------------------------------- tweet_id nyse_date class type --------------------------------- 1 2011-03-12 2
Consider this case class: case class IntPrinter(implicit val i: Int) { def print()(implicit i:

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.