8 logfile=`date "+$basedir/../log/query-%F.log.gz"`
10 # dump the old logfile
11 pg_dump -a -F p -t backup_query_log $dbname | gzip -9 > $logfile
14 psql -q -d $dbname -c 'DROP TABLE backup_query_log'
17 psql -q -1 -d $dbname -c 'ALTER TABLE new_query_log RENAME TO backup_query_log;CREATE TABLE new_query_log as (select * from backup_query_log limit 0);GRANT SELECT, INSERT, UPDATE ON new_query_log TO "www-data"'
18 psql -q -d $dbname -c 'ALTER INDEX idx_new_query_log_starttime RENAME TO idx_backup_query_log_starttime'
19 psql -q -d $dbname -c 'CREATE INDEX idx_new_query_log_starttime ON new_query_log USING BTREE (starttime)'