yum install http://repo.zabbix.com/zabbix/3.0/rhel/7/x86_64/zabbix-release-3.0-1.el7.noarch.rpm
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
test=# \pset null UNKNOW | |
Null display is "UNKNOW". | |
test=# create table employee1(id serial primary key, name text); | |
CREATE TABLE | |
test=# create table employee2(id serial primary key, name text); | |
CREATE TABLE | |
test=# -- load the fake data on employee1 | |
test=# insert into employee1 (name) SELECT '1: Person '|| generate_series(1,10); | |
INSERT 0 10 | |
test=# -- load the fake data on employee2 |
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 fnc_intervalo() | |
RETURNS SETOF interval AS | |
$$ | |
DECLARE | |
BEGIN | |
RETURN NEXT 1; | |
RETURN NEXT 2; | |
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
#!/bin/bash | |
ARCHIVEDIR='/var/lib/pgsql/wal_archive' | |
LAST_BACKUP=$(ls -lto ${ARCHIVEDIR}) | |
FILE_LIST=$(pg_archivecleanup -n "${ARCHIVEDIR}" "${LAST_BACKUP}") | |
## TEST FIRST | |
pg_archivecleanup -n "${ARCHIVEDIR}" "${LAST_BACKUP}" | find -type f -mmin +30 | xargs ls -lh |
- ~50GB MySQL Application
- Main motivation: PostGis
- Migration made with a custom tool(xml2pgcopy) and mysqldump on 45min
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
-- criação da função | |
CREATE OR REPLACE FUNCTION fnc_roda_selects() | |
RETURNS SETOF RECORD | |
AS $$ | |
DECLARE | |
rResult RECORD; | |
BEGIN | |
-- tenta buscar dados na tabela com um filtro especifico | |
PERFORM * FROM dw.dim_tempo; |
Antes de iniciar, remova o pare o banco de dados e remova o diretório de dados anterior e recrie-o novamente:
systemctl stop postgresql-9.5
rm -rf /var/lib/pgsql/9.5/data
/usr/pgsql-9.5/bin/postgresql95-setup initdb
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
--- | |
## PostgreSQL Installation on EL7 Systems | |
- hosts: all | |
vars: | |
pgdg_repo: "https://download.postgresql.org/pub/repos/yum" | |
pg_version: "9.5" | |
repo_file: "{{pgdg_repo}}/{{pg_version}}/redhat/rhel-7-x86_64/pgdg-centos{{pg_version | replace('.','')}}-{{pg_version}}-2.noarch.rpm" | |
pg_packages_base: "postgresql{{pg_version | replace('.','')}}" | |
tasks: | |
- name: Install needed repos |