Project

General

Profile

« Previous | Next » 

Revision 6042

make_analytical_db: Run the SQL commands directly with psql instead of using the make_analytical_db() function. This provides incremental results and avoids running all commands in one transaction, thus preventing pgAdmin from freezing when the user attempts to access a table used in analytical DB creation (because the TRUNCATE statement fully locks the table until the entire analytical DB is built).

View differences:

bin/make_analytical_db
3 3

  
4 4
selfDir="$(dirname -- "$0")"
5 5

  
6
echo 'SELECT make_analytical_db();'|"time" "$selfDir/psql_vegbien"
6
psql ()
7
{
8
    (echo '\\timing on'; cat)|\
9
    (set -x; "time" "$selfDir/psql_vegbien" --set=ON_ERROR_STOP=1 --quiet \
10
--echo-all)
11
}
12

  
13
psql <<EOF
14
SELECT make_family_higher_plant_group();
15

  
16
TRUNCATE analytical_stem;
17
INSERT INTO analytical_stem SELECT * FROM analytical_stem_view;
18
TRUNCATE analytical_aggregate;
19
INSERT INTO analytical_aggregate SELECT * FROM analytical_aggregate_view;
20
TRUNCATE geoscrub_input;
21
INSERT INTO geoscrub_input SELECT * FROM geoscrub_input_view;
22
EOF

Also available in: Unified diff