Five Second Demo
This query computes the top US airports by total number of inbound flights in 2008, as well as the change from 2008 to 2009:
The source dataset is available on Splitgraph. Despite it containing over 3.6 million rows, this query completes in milliseconds, thanks to a combination of Splitgraph's columnar storage and query result caching.
Run the query from the CLI
You can submit a query to the Splitgraph HTTP API from the
command line. If you have curl
and jq
installed on your system, run this:
jq -Rs '{sql: .}' <<EOF \
| curl https://data.splitgraph.com/sql/query/ddn \
-H 'Content-Type: application/json' \
-d @- \
| jq '.rows'
SELECT
destination_airport,
sum(flights) FILTER (WHERE fly_month BETWEEN '2008-01-01' AND '2009-01-01') AS flights_2008,
sum(flights) FILTER (WHERE fly_month BETWEEN '2009-01-01' AND '2010-01-01') AS flights_2009
FROM "splitgraph/domestic_us_flights:latest"."flights"
GROUP BY 1 ORDER BY flights_2008 DESC NULLS LAST
LIMIT 5;
EOF