Changeset 12441 for branches/HiveStatistics/sources/HeuristicLab.Services.Hive.DataAccess/3.3/SQL Scripts/Initialize Hive Database.sql
- Timestamp:
- 06/12/15 17:04:39 (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/HiveStatistics/sources/HeuristicLab.Services.Hive.DataAccess/3.3/SQL Scripts/Initialize Hive Database.sql
r9665 r12441 196 196 ALTER TABLE [SlaveStatistics] 197 197 ADD CONSTRAINT [Statistics_SlaveStatistics] FOREIGN KEY ([StatisticsId]) REFERENCES [Statistics]([StatisticsId]) 198 199 GO 200 CREATE SCHEMA [statistics] 201 GO 202 203 CREATE TABLE [statistics].[DimTime] ( 204 [Time] DATETIME NOT NULL, 205 [Hour] DATETIME NOT NULL, 206 [Day] DATE NOT NULL, 207 [Month] DATE NOT NULL, 208 [Year] DATE NOT NULL, 209 CONSTRAINT [PK_DimTime] PRIMARY KEY CLUSTERED ([Time] ASC) 210 ); 211 CREATE TABLE [statistics].[DimClient] ( 212 [Id] UNIQUEIDENTIFIER CONSTRAINT [DF_DimClient_Id] DEFAULT (newsequentialid()) NOT NULL, 213 [Name] VARCHAR (MAX) NOT NULL, 214 [ResourceId] UNIQUEIDENTIFIER NOT NULL, 215 [ExpirationTime] DATETIME NULL, 216 [ResourceGroupId] UNIQUEIDENTIFIER NULL, 217 [ResourceGroup2Id] UNIQUEIDENTIFIER NULL, 218 CONSTRAINT [PK_DimClient] PRIMARY KEY CLUSTERED ([Id] ASC) 219 ); 220 CREATE TABLE [statistics].[DimJob] ( 221 [JobId] UNIQUEIDENTIFIER NOT NULL, 222 [UserId] UNIQUEIDENTIFIER NOT NULL, 223 [JobName] VARCHAR (MAX) NOT NULL, 224 [UserName] VARCHAR (MAX) NOT NULL, 225 CONSTRAINT [PK_DimJob] PRIMARY KEY CLUSTERED ([JobId] ASC) 226 ); 227 CREATE TABLE [statistics].[DimUser] ( 228 [UserId] UNIQUEIDENTIFIER NOT NULL, 229 [Name] VARCHAR (MAX) NOT NULL, 230 CONSTRAINT [PK_DimUser] PRIMARY KEY CLUSTERED ([UserId] ASC) 231 ); 232 CREATE TABLE [statistics].[FactClientInfo] ( 233 [ClientId] UNIQUEIDENTIFIER NOT NULL, 234 [Time] DATETIME NOT NULL, 235 [UserId] UNIQUEIDENTIFIER NOT NULL, 236 [NumUsedCores] INT NOT NULL, 237 [NumTotalCores] INT NOT NULL, 238 [UsedMemory] INT NOT NULL, 239 [TotalMemory] INT NOT NULL, 240 [CpuUtilization] FLOAT (53) NOT NULL, 241 [SlaveState] VarChar(15) NOT NULL, 242 [TotalTimeIdle] FLOAT (53) NOT NULL, 243 [TotalTimeCalculating] FLOAT (53) NOT NULL, 244 [TotalTimeTransferring] FLOAT (53) NOT NULL, 245 [TotalTimeOffline] FLOAT (53) NOT NULL, 246 [TotalTimeUnavailable] FLOAT (53) NOT NULL, 247 CONSTRAINT [PK_FactClientInfo] PRIMARY KEY CLUSTERED ([ClientId] ASC, [Time] ASC, [UserId] ASC), 248 CONSTRAINT [FK_FactClientInfo_DimTime] FOREIGN KEY ([Time]) REFERENCES [statistics].[DimTime] ([Time]), 249 CONSTRAINT [FK_FactClientInfo_DimClient] FOREIGN KEY ([ClientId]) REFERENCES [statistics].[DimClient] ([Id]), 250 CONSTRAINT [FK_FactClientInfo_DimUser] FOREIGN KEY ([UserId]) REFERENCES [statistics].[DimUser] ([UserId]) 251 ); 252 CREATE TABLE [statistics].[FactTask] ( 253 [TaskId] UNIQUEIDENTIFIER NOT NULL, 254 [TotalRuntime] FLOAT (53) NOT NULL, 255 [TotalWaitingTime] FLOAT (53) NOT NULL, 256 [TotalTransferTime] FLOAT (53) NOT NULL, 257 [NumCalculationRuns] INT NOT NULL, 258 [NumRetries] INT NOT NULL, 259 [CoresRequired] INT NOT NULL, 260 [MemoryRequired] INT NOT NULL, 261 [Priority] INT NOT NULL, 262 [LastClientId] UNIQUEIDENTIFIER NOT NULL, 263 [JobId] UNIQUEIDENTIFIER NOT NULL, 264 [StartTime] DATETIME NOT NULL, 265 [EndTime] DATETIME NULL, 266 [TaskState] VARCHAR (30) NOT NULL, 267 [Exception] VARCHAR (MAX) NULL, 268 CONSTRAINT [PK_FactTask] PRIMARY KEY CLUSTERED ([TaskId] ASC), 269 CONSTRAINT [FK_FactTask_DimClient] FOREIGN KEY ([LastClientId]) REFERENCES [statistics].[DimClient] ([Id]), 270 CONSTRAINT [FK_FactTask_DimJob] FOREIGN KEY ([JobId]) REFERENCES [statistics].[DimJob] ([JobId]), 271 CONSTRAINT [FK_FactTask_DimTimeStart] FOREIGN KEY ([StartTime]) REFERENCES [statistics].[DimTime] ([Time]), 272 CONSTRAINT [FK_FactTask_DimTimeEnd] FOREIGN KEY ([EndTime]) REFERENCES [statistics].[DimTime] ([Time]) 273 ); 274 275 INSERT INTO [HeuristicLab.Hive-3.3].[statistics].[DimClient] ([Id] ,[Name] ,[ResourceId]) 276 VALUES ('00000000-0000-0000-0000-000000000000' ,'NULL' ,'00000000-0000-0000-0000-000000000000')
Note: See TracChangeset
for help on using the changeset viewer.