From the course: Advanced SQL for Data Science: Time Series
Unlock the full course today
Join today to access over 22,600 courses taught by industry experts or purchase this course individually.
Indexing data set 2: Time and type Indexing - SQL Tutorial
From the course: Advanced SQL for Data Science: Time Series
Indexing data set 2: Time and type Indexing
- [Instructor] Let's do some querying and creating indexes on utilization table we just created. So let's start with a basic SELECT statement. Now in this case, let's SELECT the server ID and the average CPU utilization. This is from the time_series schema and the utilization table. And let's restrict this to a single day. So we'll say WHERE the event_time is BETWEEN March 5th, 2019 and March 6th, 2019. And we'll want to GROUP BY server ID. And we also- Again, we're not so much interested in the data, as much as the EXPLAIN plans. So I'm just going to put EXPLAIN in here. And what we see, is we have a query that's costing about 3800, 3900 computational units. Now, let's see if we can speed that up a little bit by creating an index. So I'm going to insert another statement to create INDEX. And we'll call this one, idx_util_time_serv, and this will be on time_series.utilization, and it will first be on event_time, and then server_id. So we're at 3876 computational units without an…
Practice while you learn with exercise files
Download the files the instructor uses to teach the course. Follow along and learn by watching, listening and practicing.
Contents
-
-
-
-
-
-
(Locked)
Example data set 1: Temperature by time and location2m 44s
-
(Locked)
Indexing data set 1: Time index only4m 50s
-
(Locked)
Indexing data set 1: Time and location index4m
-
(Locked)
Creating a partitioned table4m 34s
-
(Locked)
Querying a partitioned table2m 37s
-
(Locked)
Example data set 2: CPU utilization and application type1m 57s
-
(Locked)
Indexing data set 2: Time and type Indexing3m 5s
-
(Locked)
-
-
-