-
Notifications
You must be signed in to change notification settings - Fork 1
/
sync_large_views.sh
executable file
·28 lines (21 loc) · 1.05 KB
/
sync_large_views.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
#!/bin/bash
# Command :
# - ./sync_stats.sh
# - ./sync_stats.sh 2022-08-10 (to execute the script with a different date)
# Note : DATABASE_URL is automatically created on scalingo machines.
# For testing :
# DATABASE_URL=${DATABASE_URL:-'postgresql://stats:stats@localhost:5432/stats'}
# echo $DATABASE_URL
echo "Sync_views.sh"
echo "Starting job. Should display 'Done' when done, if there were no errors."
# not used, 6,6Go of data, deleted
# echo "Recreate Materialized View : "
# time psql -d $DATABASE_URL -f scripts/user_daily_visits_auser_daily_visits_agg_1ygg_1y.sql
echo "Recreate Materialized View : user_daily_visits_by_month_1y.sql "
time psql -d $DATABASE_URL -f scripts/user_daily_visits_by_month_1y.sql
# deactivate because it is too big : https://github.com/tchapgouv/tchap-stats/issues/73
#echo "Recreate Materialized View : user_daily_visits_by_month_18m"
#time psql -d $DATABASE_URL -f scripts/user_daily_visits_by_month_18m.sql
#echo "Refresh Materialized View"
#time psql -d $DATABASE_URL -f scripts/refresh_materialized_view.sql
echo "Done !"