This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- View pg_stat_activity with temporary files informations (file list and total file size) | |
-- version 0.3 | |
SELECT | |
pg_stat_activity.pid AS pid, | |
CASE WHEN LENGTH(pg_stat_activity.datname) > 16 | |
THEN SUBSTRING(pg_stat_activity.datname FROM 0 FOR 6)||'...'||SUBSTRING(pg_stat_activity.datname FROM '........$') | |
ELSE pg_stat_activity.datname | |
END | |
AS database, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# TAR with progress demo | |
# in this Gist "demo.data" is file to archive | |
total=`du demo.data -B10K --apparent-size | cut -f1` | |
export total=$total | |
BZIP2="-2 -s" tar --checkpoint=1 --checkpoint-action=exec=' printf "%03d/100\r" $((100*$TAR_CHECKPOINT/$total)) ' -cjvf demo.tar.bz2 demo.data | |
# output demo : | |
#./demoscript.sh |