Skip to content

Instantly share code, notes, and snippets.

@darrell
darrell / nyt_top52_pgrouting_example.sql
Created February 17, 2017 17:56
how to calculate the shortest path using actual air routes between all the cities in the NYT 52 Places to visit in 2017
-- Airport and Flight data can be downloaded at: http://openflights.org/data.html
-- you'll need airports.dat and routes.dat
-- (I added a couple of commercial flights that I know exist,
-- but weren't in the Open Flights data
-- OK, on to the good stuff.
-- The first thing we do is load the top 52 list, which has the place and
-- the nearest commerical airport. (This is data I just figured out by hand.
-- Where it's very ambiguous, like "Canada" I just used the appropriate capital (i.e. Ottawa))
@amitlan
amitlan / dyn-pruning.md
Last active November 16, 2018 01:14
Dynamic Partition Pruning in PG 11

Following tables are used in the examples below:

create table foo (a int);
insert into foo values (2), (3);

create table p (a int) partition by list (a);
create index on p (a);
create table p1 partition of p for values in (1);
create table p2 partition of p for values in (2);