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
-- Calculate From : http://munin-monitoring.org/browser/munin/plugins/node.d/postgres_streaming_.in | |
-- with help : http://www.postgresql.org/docs/9.3/static/monitoring-stats.html#PG-STAT-REPLICATION-VIEW | |
-- http://eulerto.blogspot.fr/2011/11/understanding-wal-nomenclature.html | |
create or replace function CalculateNumericalOffset(text) | |
returns bigint | |
language sql | |
as $$ | |
select ('x'||lpad( 'ff000000', 16, '0'))::bit(64)::bigint | |
* ('x'||lpad( split_part( $1 ,'/',1), 16, '0'))::bit(64)::bigint |
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
Add-Type -AssemblyName System.IO.Compression.FileSystem | |
function Unzip | |
{ | |
param([string]$zipfile, [string]$outpath) | |
[System.IO.Compression.ZipFile]::ExtractToDirectory($zipfile, $outpath) | |
} | |
$url = 'https://github.com/PowerShell/Win32-OpenSSH/releases/latest/' | |
$request = [System.Net.WebRequest]::Create($url) |
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
-- 1- Data collect in a database, 2 times with few hours lag | |
-- 2- 'Create table as' in another database | |
-- CREATE TABLE stats_tables AS | |
\o tables.out | |
COPY ( | |
SELECT relid , schemaname , relname , seq_scan | |
, seq_tup_read , idx_scan , idx_tup_fetch | |
, pg_table_size(relid) as table_size | |
, now() AS date_ev |