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
postgres@internal-pg-replica-pgx:~/src/pg/add-pgdg-apt-repo$ pgxn install pg_repack | |
ERROR: unexpected error: ValueError - bad version number: '1.3.0-beta1' | |
Traceback (most recent call last): | |
File "/usr/lib/python2.7/dist-packages/pgxnclient/cli.py", line 59, in script | |
main(args) | |
File "/usr/lib/python2.7/dist-packages/pgxnclient/cli.py", line 31, in main | |
run_command(opt, parser) | |
File "/usr/lib/python2.7/dist-packages/pgxnclient/commands/__init__.py", line 92, in run_command | |
return opts.cmd(opts, parser=parser).run() | |
File "/usr/lib/python2.7/dist-packages/pgxnclient/commands/install.py", line 94, in run |
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
select pg_class.relname | |
from pg_class | |
join pg_roles on pg_class.relowner = pg_roles.oid | |
where pg_class.relname = 'ints'; |
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
CREATE TABLE foo (a int); | |
INSERT INTO foo (a) VALUES (1),(1); | |
CREATE UNIQUE INDEX CONCURRENTLY ON foo(a); |
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
ED=/etc/wal-e.d/env | |
ORIG_UMASK=$(umask) | |
umask u=rwx,g=rx,o= | |
sudo mkdir -p "$ED" | |
chmod 640 AWS_SECRET_ACCESS_KEY AWS_ACCESS_KEY_ID | |
sudo rsync -va AWS_SECRET_ACCESS_KEY AWS_ACCESS_KEY_ID "$ED/" || exit $? | |
sudo chown -R root:postgres /etc/wal-e.d || exit $? |
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
CREATE OR REPLACE FUNCTION stats(my_table text, my_column text) RETURNS SETOF pg_statistic AS $$ | |
DECLARE | |
my_relid oid := (SELECT oid FROM pg_class WHERE relname = my_table); | |
my_attnum smallint := (SELECT attnum FROM pg_attribute WHERE attrelid = my_relid AND attname = my_column); | |
BEGIN | |
RETURN QUERY SELECT * FROM pg_statistic WHERE starelid = my_relid AND staattnum = my_attnum; | |
END; | |
$$ LANGUAGE plpgsql; |
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
ser_tracking_production=> select * from pg_stat_user_tables where relname = 'users'; | |
-[ RECORD 1 ]-----+------------------------------ | |
relid | 16489 | |
schemaname | public | |
relname | users | |
seq_scan | 25 | |
seq_tup_read | 1547981705 | |
idx_scan | 1643649151 | |
idx_tup_fetch | 2093475016 | |
n_tup_ins | 84162208 |
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
2015-09-02 21:59:42.445 UTC,,,25673,,55e7714e.6449,1,,2015-09-02 21:59:42 UTC,,0,LOG,00000,"ending log output to stderr",,"Future log output will go to log destination ""csvlog"".",,,,,,,"" | |
2015-09-02 21:59:42.446 UTC,,,25675,,55e7714e.644b,1,,2015-09-02 21:59:42 UTC,,0,LOG,00000,"database system was interrupted while in recovery at log time 2015-08-28 17:29:19 UTC",,"If this has occurred more than once some data might be c\ | |
orrupted and you might need to choose an earlier recovery target.",,,,,,,"" | |
2015-09-02 21:59:42.454 UTC,,,25675,,55e7714e.644b,2,,2015-09-02 21:59:42 UTC,,0,LOG,00000,"entering standby mode",,,,,,,,,"" | |
2015-09-02 21:59:42.456 UTC,,,25675,,55e7714e.644b,3,,2015-09-02 21:59:42 UTC,,0,WARNING,01000,"WAL was generated with wal_level=minimal, data may be missing",,"This happens if you temporarily set wal_level=minimal without taking a new b\ | |
ase backup.",,,,,,,"" | |
2015-09-02 21:59:42.456 UTC,,,25675,,55e7714e.644b,4,,2015-09-02 21:59:42 UTC,,0,FATAL,XX000,"hot standby is not possible because wa |
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
# Include the role (MASTER versus SLAVE) in your bash prompt. For example: | |
# | |
# quinn@tao (MASTER) ~$ | |
# | |
# I use this to remind myself which node is which during failover testing. Helpfully, this also | |
# tells you if both nodes think they're the master (or the slave). Either can happen if | |
# replication gets into a bad state. | |
# | |
# Assumptions: | |
# - psql is in your path. |