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 > DB Design question...

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 04-30-07, 13:37
darkid darkid is offline
Registered User
 
Join Date: Apr 2007
Posts: 5
DB Design question...

I have a need to keep a bunch of data regarding some wan links, and I don't know how to design my database for it.
Here's the data I need to store.

I have about 35 different links, and about 50 different application volumes that need to be stored in this database, for every hour of the day.
Right now the way I have it setup doesn't seem too good, but i can't figure out any other way.
I currently have 1 different table for each link, and every application as a column in these tables.
So for example:
Table Link 1
Date App1 App2 App3 App4
Jan 1 01:00 54613 351546 6848435 6847684
Jan 1 02:00 668468 6846433 646464 6546846

Table Link 2
Date App1 App2 App3 App4
Jan1 01:00 6846 6844354 6846434 38463434
Jan1 02:00 648458 3848646 6846 684684

etc.

The primary key on each table is the date.
I'm only storing about 7 applications right now, but I need to be able to increase this to about 50, so it's gonna make for huge queries for reporting.
The thing is I need to be able to report on total application volumes across every link.
So that means right now i'm doing a Sum(Link1.App1) + Sum(Link2.App1).... which I have to do 35 times, and then repeat again for the next application. And most reports have a lot of applications required so it makes for queries that are 20 pages long...

Is there any design solution that would make this more efficient?
Thanks!
Reply With Quote
  #2 (permalink)  
Old 04-30-07, 16:21
r937 r937 is offline
SQL Consultant
 
Join Date: Apr 2002
Location: Toronto, Canada
Posts: 19,524
you need a new table with a compound primary key -- date, link, app
__________________
r937.com | rudy.ca
please visit Simply SQL and buy my book
Reply With Quote
  #3 (permalink)  
Old 05-01-07, 07:28
darkid darkid is offline
Registered User
 
Join Date: Apr 2007
Posts: 5
Yeah...
I was thinking of doing something like this...

tb_Application
AppID tinyInt
AppName nvarchar

tb_Link
LinkID tinyInt
LinkName nvarchar

tb_Ref_App_Link
AppID tinyInt
LinkID tinyInt
Date smalldatetime
Volume float

I think this would give me a good design?
Reply With Quote
  #4 (permalink)  
Old 05-01-07, 07:47
r937 r937 is offline
SQL Consultant
 
Join Date: Apr 2002
Location: Toronto, Canada
Posts: 19,524
i would use something bigger than TINYINT, and i would use DECIMAL instead of FLOAT

otherwise, yes, that design looks okay...
__________________
r937.com | rudy.ca
please visit Simply SQL and buy my book
Reply With Quote
  #5 (permalink)  
Old 05-01-07, 07:50
darkid darkid is offline
Registered User
 
Join Date: Apr 2007
Posts: 5
Ok.
Appreciate it.

One more thing.
What if each application can belong to an application group...
like
say the application "Citrix" belongs to the app group "ThinClient".


I was thinking of creating an extra table called
tb_AppGroup
AppGroupID Int (pk)
AppGraoupName nvarchar

and modifying my tb_Application to
AppID Int (pk)
AppName nvarchar
AppGroupID Int (fk)
Reply With Quote
  #6 (permalink)  
Old 05-01-07, 10:21
r937 r937 is offline
SQL Consultant
 
Join Date: Apr 2002
Location: Toronto, Canada
Posts: 19,524
that works
__________________
r937.com | rudy.ca
please visit Simply SQL and buy my book
Reply With Quote
Reply

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