473,418 Members | 2,036 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,418 software developers and data experts.

Table Design Question - Expecting ~1 Million Records

I'm writing survey software and wanted the data to be vertical. What keys/indexes should I have so queries against the table run as quickly as possible? The fields "SurveyID" and "SurveyGUID" are used for reference. The field "SurveyField" is the name of the question (ex. "Q1", "Q2", etc...) and the field "SurveyData" is the answered value of the question.

Thanks in advance for any help!

Expand|Select|Wrap|Line Numbers
  1. USE [WebSurvey]
  2. GO
  3.  
  4. /****** Object:  Table [dbo].[SurveyData]    Script Date: 03/09/2010 01:09:35 ******/
  5. SET ANSI_NULLS ON
  6. GO
  7.  
  8. SET QUOTED_IDENTIFIER ON
  9. GO
  10.  
  11. CREATE TABLE [dbo].[SurveyData](
  12.     [RID] [int] IDENTITY(1,1) NOT NULL,
  13.     [SurveyID] [int] NOT NULL,
  14.     [SurveyGUID] [nvarchar](50) NOT NULL,
  15.     [SessionID] [nvarchar](50) NOT NULL,
  16.     [SurveyField] [nvarchar](50) NOT NULL,
  17.     [SurveyData] [nvarchar](max) NULL,
  18.     [DateTime] [datetime] NOT NULL,
  19.     [isQueryString] [bit] NOT NULL,
  20.  CONSTRAINT [PK_SurveyData] PRIMARY KEY CLUSTERED 
  21. (
  22.     [RID] ASC
  23. )WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
  24. ) ON [PRIMARY]
  25.  
  26. GO
  27.  
  28. ALTER TABLE [dbo].[SurveyData] ADD  CONSTRAINT [DF_SurveyData_DateTime]  DEFAULT (getdate()) FOR [DateTime]
  29. GO
  30.  
  31. ALTER TABLE [dbo].[SurveyData] ADD  CONSTRAINT [DF_SurveyData_isQueryString]  DEFAULT ((0)) FOR [isQueryString]
  32. GO
Mar 9 '10 #1
1 1789
ck9663
2,878 Expert 2GB
It depends on a lot of things including how you want the result of your query should look like. Aggregated? Detailed? etc.

Good Luck!!!

~~ CK
Mar 9 '10 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: Bill | last post by:
Now, I know that *theoretically* one can have some unattainably great number of records in a table. But, in practicality (and I know "it depends"), how many records can I plan to have in a table...
1
by: Jay | last post by:
Hi I have a huge table with over 100million records and on regular basis ineed to delete nearly a million records and insert a million records. Currently I delete indexes before going through the...
7
by: Warren Wright | last post by:
Hello, We maintain a 175 million record database table for our customer. This is an extract of some data collected for them by a third party vendor, who sends us regular updates to that data...
4
by: harish | last post by:
DELETING 100 million from a table weekly SQl SERVER 2000 Hi All We have a table in SQL SERVER 2000 which has about 250 million records and this will be growing by 100 million every week. At a...
9
by: VMI | last post by:
We have this huge application that's based on storing tons of data on a dataTable. The only problem we're having is that storing LOTS of data (1 million records) into a datatable will slow down the...
17
by: Lauren Quantrell | last post by:
Using MS Access 2K, I have a client with a number of seperate customer tables for each country, approx 50 tables, stored on a SQL Server backend. I cleaned up the data in the tables and inserted...
2
by: mvl_groups_user | last post by:
I am trying to look up data on about 1000 records from a 6 million record view on a DB2 database using msaccess. The 6 million record DB2 view is connected through a linked ODBC table (table A),...
12
by: GCM | last post by:
Hi, I have a table that has the following fields; LName, FName and MName. Also there are other fields in the table. I need to create another table with those fields combined as "Trim( & " " & &...
15
by: l3vi | last post by:
I have a new system Im building that stores entries of what people are searching for on my sites. I want to be able to keep records of how many times a keyword was searched for daily, and from...
8
by: rshivaraman | last post by:
Hi : I have a TableA with around 10 columns with varchar and numeric datatypes It has 500 million records and its size is 999999999 KB. i believe it is kb i got this data after running...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.