If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > General > Database Concepts & Design > Newbie Design Help for large amounts of Data

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 01-20-12, 04:27
anoncat anoncat is offline
Registered User
 
Join Date: Jan 2012
Posts: 4
Newbie Design Help for large amounts of Data

Hello,

I'm developing an application in C# using sqlite that tracks unit sales daily, for the entirety of the current year. Currently I have one monolithic table with a column of each day of the year and one for the timestamp of when the sales were recorded, and each row representing unit sales for that day of the timestamp.

To complicate things further I need to be able to access the data to compare unit sales based on the sell date (so say compare the 1st of the month to the 2nd to see what has been sold for what dates in that time period) as well as the sell date (for example to look at the first Saturday of March and determine what dates sold the most for that day in the year).

I apologize if this is a bit much to ask but I've not really had to deal with such a large amount of data before and want to utilize the best design for the database to keep the queries as quick as possible. I just thought I would seek some advise on if there is a more optimal approach to handling the data given my needs. Thank you for your time and patience.
Reply With Quote
  #2 (permalink)  
Old 01-20-12, 04:51
r937 r937 is offline
SQL Consultant
 
Join Date: Apr 2002
Location: Toronto, Canada
Posts: 19,524
Quote:
Originally Posted by anoncat View Post
I just thought I would seek some advise on if there is a more optimal approach to handling the data given my needs.
one column per day of the year is definitely poor design

i didn't understand what you meant by "each row representing unit sales for that day of the timestamp"
__________________
r937.com | rudy.ca
please visit Simply SQL and buy my book
Reply With Quote
  #3 (permalink)  
Old 01-20-12, 17:09
anoncat anoncat is offline
Registered User
 
Join Date: Jan 2012
Posts: 4
Sorry, english is not my best language. I think I mean to say that each row in the database table represents a single day of unit sales for the timestamp in that row..

I know that is bad design but do you perhaps have the ability to enlighten me for a better solution?
Reply With Quote
  #4 (permalink)  
Old 01-20-12, 17:18
r937 r937 is offline
SQL Consultant
 
Join Date: Apr 2002
Location: Toronto, Canada
Posts: 19,524
could you please tell me all the columns in your table
__________________
r937.com | rudy.ca
please visit Simply SQL and buy my book
Reply With Quote
  #5 (permalink)  
Old 01-21-12, 11:00
anoncat anoncat is offline
Registered User
 
Join Date: Jan 2012
Posts: 4
Of course, it is simply 1 column for the time of submission and then another column for each day of the year.
Reply With Quote
  #6 (permalink)  
Old 01-27-12, 01:42
anoncat anoncat is offline
Registered User
 
Join Date: Jan 2012
Posts: 4
Hi,

I attach some example in text to illustrate my data model. So i made some changes from original. I use 1 table to manage all times a user adds data in the index table and each months data for the year in a separated table. Now the tricky part I think I can use a database for each year this would keep the current working database smaller as data from older years is not necessary on a day to day basis but needs to be available if needed. Is this an efficient way to handle this data?
Attached Files
File Type: txt dbdesign.txt (8.9 KB, 2 views)
Reply With Quote
  #7 (permalink)  
Old 01-27-12, 03:13
r937 r937 is offline
SQL Consultant
 
Join Date: Apr 2002
Location: Toronto, Canada
Posts: 19,524
Quote:
Originally Posted by anoncat View Post
Is this an efficient way to handle this data?
no!

not if you have separate tables for each month, with columns for all the days in the month

go back to the design that had only two columns
__________________
r937.com | rudy.ca
please visit Simply SQL and buy my book
Reply With Quote
Reply

Tags
c# .net database sqlite

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On