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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T19:03:54+00:00 2026-05-13T19:03:54+00:00

I have an application that sends data based on user interaction (not user input).

  • 0

I have an application that sends data based on user interaction (not user input). The data sent could be an Integer, String, Date, or Boolean value. There are 140 keys. We may get anywhere from 1 key value pair to all 140 at a time.

We want to store everything but will only be using 20 out of 140 keys within the application. The remaining will be used for an audit trail later on – so we still need to store them.

This data is used by the application to decide where the user needs to go so it needs to access the record by student id and pull the 20 or so options within milliseconds. There could be billions of rows of data (it is an upgrade to an existing application with over 20,000 users) so performance is critical. The user generates a new row each time they access the application.

EXAMPLE DATA:

Score:1
ID:3212
IsLast:False
Action:Completed

I have 2 ideas on how to do this and looking for some help on which is best or is a third option a better choice.

OPTION 1:

My first idea is to use a column for the value as a string then have a look-up table of possible data types to use when the value needs to be Cast for use.

value       | dataType
-----------------------
"1"         | int
"Completed" | string

While the data being sent is not user generated I know there must be a gotcha somewhere in this method. The only reason for doing this is that we don’t know what key:pair will be sent (outside of date and id) and trying to avoid more than a few columns.

The SO Question
How to Handle Unknown Data Type in one Table uses a similar idea.

OPTION 2:

The other solution is to have 140 columns – one for each key. However, the amount of data generated is very large (billions of rows) so that calling this data will not be fast enough – I don’t think.

Technical Details:
This is using SQL Server 2008 – not R2 with DotNet C# and Reporting Services.

Am I missing something here – what is the best way to create this table for performance?

  • 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-13T19:03:55+00:00Added an answer on May 13, 2026 at 7:03 pm

    Vertically segment your data. Put the 20 keys that are necessary for navigational control in one table, all 20 in one row, with PK that identifies the user Interaction (Callit say, InteractionId). Put the other 120 values in another table, with composite Primary Key, based on the PK of the first table (InteractionId, plus the KeyTypeId identifying which of the 120 possible key value pairs the value is for. Store all the values in this second table as strings. In a third lookup table called, say, KeyTypes, store the KeyTypeId, KeyTypeName, and KeyValueDataType to allow your code to know how to cast the string value to output it properly as either a string, datetime, an integer, or a decimal value or whatever…

    The first table will be accessed much more often, and so it contains only those values which the application’s navigational functionality needs more frequent access to, keeping the rows narrower, which allows more rows per page, and minimizes disk IO. Putting all 20 values in one row will keep the row count smaller (~ 1/20th as large), minimizng the depth of the index seeks that will need to be performed for each access.

    The other table with all the other 120 key-values will not be accessed as frequently, so it’s structure can probably be optimized for logical simplicity rather than for performance.

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

Sidebar

Ask A Question

Stats

  • Questions 369k
  • Answers 369k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer Yeah, this can be done using the signals framework. from… May 14, 2026 at 6:14 pm
  • Editorial Team
    Editorial Team added an answer The @ in front of md5_file suppresses any warnings/errors that… May 14, 2026 at 6:14 pm
  • Editorial Team
    Editorial Team added an answer I'm better with Tomcat than JBoss, but it should be… May 14, 2026 at 6:14 pm

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

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.