From the course: Advanced SQL for Application Development
Unlock the full course today
Join today to access over 24,800 courses taught by industry experts.
Querying partitioned tables
From the course: Advanced SQL for Application Development
Querying partitioned tables
- [Narrator] When we use partition tables, we want to keep in mind our partitioning logic when we're writing queries against those tables. We need to keep in mind our partition key. Now again, the partition key determines where a row is stored and so when you write queries, when you write select statements in sequel, you want to be sure to use a partition key or reference the partition key in the where clause whenever possible, so for example, writing a select statement using a partition key might look something as simple as this. So here I have a table called sales history and I want to select where month equals three. That allows us to focus on the partition where the partition key has a value of three, so if you don't use a partition key in the where clause, then you risk scanning all of the different partitions, which can undermine the utility and the benefits of the using partitioning, so that's why we want to keep in…
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)
Overview of partitioning7m 10s
-
(Locked)
Range partitioning5m 52s
-
List partitioning3m 7s
-
(Locked)
Hash partitioning4m 27s
-
(Locked)
Querying partitioned tables1m 3s
-
(Locked)
Using read-only replicas1m 41s
-
(Locked)
Challenge: Define a partitioned table37s
-
(Locked)
Solution: Defining a partitioned table54s
-
(Locked)
-
-
-