-
Notifications
You must be signed in to change notification settings - Fork 0
Filtering Rows with "Where"
Understanding filtering rows with WHERE can help us write more complicated queries later on down the road.

The key here is not to read this from left to right. A better way to understand what is going on with this query is to look at the actual order being executed by Postgres below:

The first thing that really happens internally is that Postgres takes a look at a data source, its going to analyze a query and see you are trying to pull in all the different rows from cities table and then applies the search criteria where for each row in cities table, it wants an area greater than 4000. That will filter out some rows from our result set and for remaining rows we select some number of columns, so we want to consider FROM being executed first, then WHERE and SELECT being executed third.