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 417247
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 12, 20262026-05-12T18:33:41+00:00 2026-05-12T18:33:41+00:00

This is a FACT Table in a Data Warehouse It has a composite index

  • 0

This is a FACT Table in a Data Warehouse

It has a composite index as follows

ALTER TABLE [dbo].[Fact_Data] 
ADD  CONSTRAINT [PK_Fact_Data] 
PRIMARY KEY CLUSTERED 
(
    [Column1_VarChar_10] ASC,
    [Column2_VarChar_10] ASC,
    [Column3_Int] ASC,
    [Column4_Int] ASC,
    [Column5_VarChar_10] ASC,
    [Column6_VarChar_10] ASC,
    [Column7_DateTime] ASC,
    [Column8_DateTime] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, 
SORT_IN_TEMPDB = OFF, IGNORE_DUP_KEY = OFF, ONLINE = OFF, 
ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON
) ON [PRIMARY]
GO

In this structure, all of the varchar 10 columns have numeric values only. Is it going to be beneficial for me to change this 78 million row structure to hold BIGINT instead of VARCHAR in terms of querying and indexing?

Any other benefits / drawbacks that I should consider?

  • 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-12T18:33:41+00:00Added an answer on May 12, 2026 at 6:33 pm

    You should DEFINITELY introduce a surrogate INT IDENTITY() primary key!!
    INT already gives you potentially up to 2 billion rows – isn’t that enough??

    This primary key / clustered key on SQL Server will be up to 64 bytes in size (instead of 4, for a INT) – which will make your clustered index AND all your non-clustered index be bloated beyond recognition. The whole clustering key (all your 8 columns) will be included on every single page of every single non-clustered index on that table – wasting lots and lots of space for sure.

    So on any given index table, you would have up to 16 times more entries with a surrogate INT clustered key – that means lots less I/O, lots less time wasted reading index pages.

    And just imagine trying to establish a foreign-key relationship to that table…. any child table would have to have all 8 columns of your primary key as foreign key columns, and specify all 8 columns in every join – what a nightmare!!

    At 78 million rows, even just changing the clustering key to INT IDENTITY will save you up to 60 bytes per row – that alone would come out to be up to 4 GByte of disk space (and RAM usage in your server). And that’s not even beginning to calculate the savings on the non-clustered indices…….

    And of course, yes, I would also change the VARCHAR(10) to INT or BIGINT – if it’s a number, make the field type numeric – no point in leaving it at VARCHAR(10), really. But that alone is not going to make a huge difference in terms of speed or performance – it just makes working with the data that much easier (don’t have to always cast around to numeric types when e.g. comparing values and so forth).

    Marc

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

Sidebar

Related Questions

This is my first attempts at creating a data-mart/warehouse and I am a little
Okay, so I have this problem with my Fact Table. I need it to
My warehouse datamart data is split across 3 databases on the same server. This
I'm working rearchitecting a reporting/data warehouse type database. We currently have a table that
I have a table with arbitrary columns and rows. This fact is irrelevant though
I have a table of data that looks a bit like this: Name StartTime
I'm in the process of designing the fact table for a data cube, and
I have a fact table that contains some finance data. There is a column
The associativity of stream insertion operator is rtl, forgetting this fact sometimes cause to
I always found this rather annoying fact about applets, that they disappear if you

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.