About this project
You may be on this repository because you have seen my talk on EXPLAIN. Welcome !
On this repository you will find a dump of the database, a few SQL lines used to generate data, and the queries used during this talk.
Lost the slides ?
Here they are
How to get started with this project ?
Create the database
First you need to create a database
CREATE DATABASE owl_conference WITH OWNER owl;
Then you can simply use the dump, in your shell
$ psql owl_conference < sql/dump.sql
I put the code using
generate_series that I used to generate humans and letters (with random foreign keys to humans).
You can see that in
Test the python joins
Use a virtualenv with
Then you can do
$ python manage.py shell
hash_join and the
nested_loop like this
>>> from owl.utils.joins import * >>> data = nested_loops() >>> print(data.job) >>> data = hash_join() >>> print(data.job)
You can try the
suspicious_letters from the slide 44 of the talk by running in the python shell
>>> from owl.utils.examples import * >>> data = suspicious_letters() >>> print(data)
Test the queries
sql/02_queries.sql you have all the queries from the conference. The last one is the funiest one ;)
Go into your psql and try looking at the
$ psql owl_conference