This repository was archived by the owner on Jun 10, 2026. It is now read-only.
Repository navigation
Expand file tree
/
Copy pathcreatepagecompressedtable.sql
More file actions
83 lines (82 loc) · 2.26 KB
/
Copy pathcreatepagecompressedtable.sql
File metadata and controls
83 lines (82 loc) · 2.26 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
-- This script creates airlineWithPageComp table needed for running perf tuning tests.
use PerfTuning;
go
IF EXISTS (SELECT * FROM INFORMATION_SCHEMA.TABLES
WHERE TABLE_NAME = N'airlineWithPageComp')
BEGIN
PRINT 'dropping existing table airlineWithPageComp'
drop table [airlineWithPageComp];
END
CREATE TABLE [dbo].[airlineWithPageComp](
[Year] [int] NULL,
[Month] [int] NULL,
[DayofMonth] [int] NULL,
[DayOfWeek] [bigint] NULL,
[FlightDate] [float] NULL,
[UniqueCarrier] [nvarchar](255) NULL,
[TailNum] [nvarchar](255) NULL,
[FlightNum] [nvarchar](255) NULL,
[OriginAirportID] [nvarchar](255) NULL,
[Origin] [nvarchar](255) NULL,
[OriginState] [nvarchar](255) NULL,
[DestAirportID] [nvarchar](255) NULL,
[Dest] [nvarchar](255) NULL,
[DestState] [nvarchar](255) NULL,
[CRSDepTime] [float] NULL,
[DepTime] [float] NULL,
[DepDelay] [int] NULL,
[DepDelayMinutes] [int] NULL,
[DepDel15] [bit] NULL,
[DepDelayGroups] [nvarchar](255) NULL,
[TaxiOut] [int] NULL,
[WheelsOff] [float] NULL,
[WheelsOn] [float] NULL,
[TaxiIn] [int] NULL,
[CRSArrTime] [float] NULL,
[ArrTime] [float] NULL,
[ArrDelay] [int] NULL,
[ArrDelayMinutes] [int] NULL,
[ArrDel15] [bit] NULL,
[ArrDelayGroups] [nvarchar](255) NULL,
[Cancelled] [bit] NULL,
[CancellationCode] [nvarchar](255) NULL,
[Diverted] [bit] NULL,
[CRSElapsedTime] [int] NULL,
[ActualElapsedTime] [int] NULL,
[AirTime] [int] NULL,
[Flights] [int] NULL,
[Distance] [int] NULL,
[DistanceGroup] [nvarchar](255) NULL,
[CarrierDelay] [int] NULL,
[WeatherDelay] [int] NULL,
[NASDelay] [int] NULL,
[SecurityDelay] [int] NULL,
[LateAircraftDelay] [int] NULL,
[MonthsSince198710] [int] NULL,
[DaysSince19871001] [int] NULL,
[rowNum] [int] NULL
);
GO
CREATE CLUSTERED INDEX simple_index ON airlineWithPageComp (rowNum);
GO
ALTER TABLE airlineWithPageComp REBUILD PARTITION = ALL
WITH (DATA_COMPRESSION = PAGE);
GO
ALTER TABLE airlineWithPageComp
ADD Late BIT
ALTER TABLE airlineWithPageComp
ADD CRSDepHour int
GO
PRINT 'inserting data from airlineWithIndex into airlineWithPageComp'
GO
INSERT INTO airlineWithPageComp SELECT * FROM airlineWithIndex
GO
PRINT 'inserting data done'
GO
PRINT 'rebuilding index after insert operations'
GO
ALTER INDEX simple_index ON airlineWithPageComp
REBUILD
GO
PRINT 'rebuilding done'
GO