From the course: Advanced SQL for Data Scientists

Unlock the full course today

Join today to access over 22,600 courses taught by industry experts or purchase this course individually.

Analyzing a query with WHERE clauses and indexes

Analyzing a query with WHERE clauses and indexes

From the course: Advanced SQL for Data Scientists

Start my 1-month free trial

Analyzing a query with WHERE clauses and indexes

- [Instructor] Now let's take a look at using explained plan with a select statement that has a where clause. So to do that, we're going to explain select, let's just select star and we'll work with our time series data. So we'll say from, the IOT schema and we're going to use sensor measurement and let's say where sensor ID between 10 and 20, and let's execute that, and let's see what come up with. A couple of things to point out here. Here this top level operation, the append is sort of the outermost operation and then we can kind of drill down almost like in a modular way to the next set of operations. So the first operation under a pen, is a sequence scan and you'll notice it's scanning one of the partitions. Now this is the month one partition and below that there's another sequence scan scanning the month two partition. So these are two operations that can happen in parallel and Postgres can optimize and do things…

Contents