From the course: Advanced SQL for Query Tuning and Performance Optimization

Unlock the full course today

Join today to access over 24,800 courses taught by industry experts.

Partition by range example

Partition by range example

- [Instructor] Let's see how we create a table that uses range partitioning. We'll use an IOT table as an example, so let's issue a create table command. Create table, and the table we'll create is called iot_measurement. And let's have a location_id which will make an integer, and that's required so it's not null. And the measurement_datetime, and that's of type timestamp and that's not null. And let's have a temperature in Celsius, and we'll track that as an integer. And let's get relative humidity or rel_humidity. And we'll track the percent of relative humidity and that can be an integer as well. So that's a very basic table. Now we're going to add a clause which defines how we want to do partitioning. And we do that by adding the word partition by range, so we're specifying that we want to do partitioning and we want to use range partitioning. And we want that range to be defined over the measurement_datetime.…

Contents