From 61af8e951727cf52a719a13ed9c6f6a6adde2cd2 Mon Sep 17 00:00:00 2001
From: ImreSamu <ImreSamu@users.noreply.github.com>
Date: Fri, 20 Jan 2017 23:30:02 +0100
Subject: [PATCH] add `make psql-analyze` and `make psql-vacuum-analyze`

---
 Makefile      | 11 ++++++++++-
 quickstart.sh |  5 +++++
 2 files changed, 15 insertions(+), 1 deletion(-)

diff --git a/Makefile b/Makefile
index 05a662fb..fd9794e7 100644
--- a/Makefile
+++ b/Makefile
@@ -18,6 +18,8 @@ help:
 	@echo "  make download-geofabrik area=albania # download OSM data from geofabrik, and create config file"
 	@echo "  make psql                            # start PostgreSQL console "
 	@echo "  make psql-list-tables                # list all PostgreSQL tables "
+	@echo "  make psql-vacuum-analyze             # PostgreSQL: VACUUM ANALYZE"
+	@echo "  make psql-analyze                    # PostgreSQL: ANALYZE"
 	@echo "  make generate-qareports              # generate reports [./build/qareports]"
 	@echo "  make generate-devdoc                 # generate devdoc  [./build/devdoc]"
 	@echo "  make import-sql-dev                  # start import-sql  /bin/bash terminal "
@@ -31,7 +33,6 @@ help:
 	@echo "  make pgclimb-list-tables             # list PostgreSQL public schema tabless"
 	@echo "  cat  .env                            # list PG database and MIN_ZOOM and MAX_ZOOM informations"
 	@echo "  cat ./quickstart.log                 # backup  of the last ./quickstart.sh "
-	@echo "  ....TODO....                         # start lukasmartinelli/postgis-editor"
 	@echo "  make help                            # help about avaialable commands"
 	@echo "=============================================================================="
 
@@ -91,6 +92,14 @@ pgclimb-list-views:
 pgclimb-list-tables:
 	docker-compose run --rm import-osm /usr/src/app/pgclimb.sh -c "select schemaname,tablename from pg_tables where schemaname='public' order by tablename;" csv
 
+psql-vacuum-analyze:
+	@echo "Start - postgresql: VACUUM ANALYZE VERBOSE;"
+	docker-compose run --rm import-osm /usr/src/app/psql.sh  -P pager=off  -c 'VACUUM ANALYZE VERBOSE;'
+
+psql-analyze:
+	@echo "Start - postgresql: ANALYZE VERBOSE ;"
+	docker-compose run --rm import-osm /usr/src/app/psql.sh  -P pager=off  -c 'ANALYZE VERBOSE;'
+
 import-sql-dev:
 	docker-compose run --rm import-sql /bin/bash
 
diff --git a/quickstart.sh b/quickstart.sh
index a266e08a..673d2a00 100755
--- a/quickstart.sh
+++ b/quickstart.sh
@@ -237,6 +237,11 @@ echo "====> : Start SQL postprocessing:  ./build/tileset.sql -> PostgreSQL "
 echo "      : Source code: https://github.com/openmaptiles/import-sql "
 docker-compose run --rm import-sql
 
+echo " "
+echo "-------------------------------------------------------------------------------------"
+echo "====> : Analyze PostgreSQL tables"
+make psql-analyze
+
 echo " "
 echo "-------------------------------------------------------------------------------------"
 echo "====> : Start generating MBTiles (containing gzipped MVT PBF) from a TM2Source project. "