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 1: Time and location index

Indexing data set 1: Time and location index - SQL Tutorial

From the course: Advanced SQL for Data Science: Time Series

Start my 1-month free trial

Indexing data set 1: Time and location index

- [Instructor] Now, let's work with indexes but this time instead of working just with location, let's use event time in our index and see if that helps improve things. First thing I want to do is come over here to the indexes under the location temp column and I want to click refresh, and let's see if we have any indexes. Okay, so there are no indexes there. So we're starting with an index-free schema here, or at least with respect to this table, and we're going to work with our basic SQL query that we've been working with, which is to select by location ID the average temperature. And that's from the time series schema table called location temp. Now, I want to select based on time so I'm going to have a where clause that references event time and I'm going to select other rows on a particular day. So I'll use the between operator and we'll pick the day of March 5th, 2019. And we'll go to the 6th. One convenient thing about working with dates with Postgres is it if a string is in a…

Contents