]> git.somenet.org - pub/jan/adbs.git/blob - ex1/ex15a.sh
GITOLITE.txt
[pub/jan/adbs.git] / ex1 / ex15a.sh
1 #!/bin/sh
2
3 EXPLAIN="EXPLAIN(ANALYZE,COSTS)"
4
5 echo "ex1.5.a unoptimized"
6 echo "${EXPLAIN} SELECT distinct(displayname) FROM users u WHERE id IN (SELECT owneruserid FROM posts p WHERE p.viewcount > u.views);" | psql
7
8 echo "ex1.5.a optimized"
9 echo "${EXPLAIN} SELECT distinct(displayname) FROM posts p JOIN users u ON u.id = p.owneruserid WHERE p.viewcount > u.views;" | psql