SlideShare une entreprise Scribd logo
1  sur  24
Télécharger pour lire hors ligne
When PostgreSQL Can't,
You Can
● Keith Fiske
● DBA @ OmniTI
http://www.omniti.com keith@omniti.com
http://www.keithf4.com @keithf4
OmniTI, Inc
● Full-stack support for high-traffic websites & applications
– Millions of users
– Terabytes of data
● Surge Conference - http://omniti.com/surge
– Disaster Porn
– Annually in Sept (just last week)
● We're hiring!
PostgreSQL Can't
● Dump filtering
● Autonomous Functions
● Logical Replication
● Partition Management
PG Extractor
● pg_dump limitations (-t, -n)
● Filter by schema, table, view, function, sequence, type, trigger, owner
● Dumps each database object to its own file in organized folders
● Use regex matching
● Limited integration with SVN & Git
Extensions
● Introduced in 9.1
● Logically grouped set of database objects
– CREATE EXTENSION pg_partman;
● Versioned
– ALTER EXTENSION pg_partman UPDATE TO '1.4.0';
– Update and revert changes predictably.
● All following extensions are done in PL/PGSQL
– Extremely easy to get you're code installed and managed
by the database.
PG Job Monitor
(pg_jobmon)
● Autonomous functions
● Log steps of running function
● Monitors logged functions to ensure they complete
● If/when they fail, where and why
PG Jobmon
add_job('job name');
add_step(job_id, 'What this step will do');
… do some stuff...
update_step(step_id, 'good_status', 'What this step did successfully');
add_step(job_id, 'What this next step will do');
...do some stuff in a loop...
update_step(step_id, 'good_status', 'update every loop iteration to track progress');
add_step(job_id, 'One last step');
… do just a bit more stuff...
update_step(step_id, 'good_status', 'Job finished ok');
close_job(job_id);
EXCEPTION
WHEN OTHERS THEN
update_step(step_id, 'bad_status', 'Uh..oh...: '||coalesce(SQLERRM,'wat'));
fail_job(job_id);
PG Jobmon
show_job('my job name', [int]);
-[ RECORD 3 ]-----------------------------
job_id | 10
owner | keith
job_name | PG_JOBMON TEST BAD JOB
start_time | 2012-09-15 00:55:44.742176-04
end_time | 2012-09-15 00:55:44.851514-04
status | CRITICAL
pid | 5848
-[ RECORD 4 ]-----------------------------
job_id | 9
owner | keith
job_name | PG_JOBMON TEST GOOD JOB
start_time | 2012-09-15 00:55:44.293575-04
end_time | 2012-09-15 00:55:44.725483-04
status | OK
pid | 5848
show_job_like('I forgot my job's whole name', [int]);
show_detail(job_id);
show_detail('job_name', [int]);
show_job_status('bad_status', [int]);
show_job_status('job name', 'status', [int]);
show_running([int]);
-[ RECORD 1 ]+------------------------------
job_id | 9
step_id | 19
action | Test step 1
start_time | 2012-09-15 00:55:44.501825-04
end_time | 2012-09-15 00:55:44.593389-04
elapsed_time | 0.091564
status | OK
message | Successful Step 1
-[ RECORD 2 ]+------------------------------
job_id | 9
step_id | 20
action | Test step 2
start_time | 2012-09-15 00:55:44.643017-04
end_time | 2012-09-15 00:55:44.659336-04
elapsed_time | 0.016319
status | OK
message | Rows affected: 2
-[ RECORD 3 ]+------------------------------
job_id | 9
step_id | 21
action | Test step 3
start_time | 2012-09-15 00:55:44.692518-04
end_time | 2012-09-15 00:55:44.7087-04
elapsed_time | 0.016182
status | OK
message | Successful Step 3
PG Jobmon
check_job_status();
● Make nagios check (command and service configs on my blog)
● Shameless plug – http://circonus.com (howto on my blog)
SELECT t.alert_text || c.alert_text AS alert_status
FROM jobmon.check_job_status() c
JOIN jobmon.job_status_text t ON c.alert_code = t.alert_code;
alert_status
-------------------------------
OK(All jobs run successfully)
alert_status
--------------------------------------------------------------
CRITICAL(KEITH.SOME_OTHER_PROCESS: MISSING - Last run at 2012-09-13
07:17:07.86378-04; KEITH.ANOTHER_PROCESS: MISSING - Last run at 2012-09-13
07:16:30.169683-04;)
alert_status
--------------------------------------------------------------
WARNING(KEITH.SOME_CRITICAL_PROCESS: RUNNING; )
Mimeo
Logical (per-table) Replication Extension
“The stencil duplicator or mimeograph machine
(often abbreviated to mimeo) is a low-cost
printing press that works by forcing ink through a
stencil onto paper...Mimeographs were a
common technology in printing small quantities,
as in office work, classroom materials, and
church bulletins.” – Wikipedia
Mimeo
● Streaming & Log Shipping Replication (omnipitr)
● Per-table replication
– Snapshot
– Incremental
– DML
● Quick replication setup and tear-down
● Installed & run from destination database
● No superuser required
● Advanced options (column filter, where condition)
● Monitor & Audit Trail w/ PG Jobmon
Types of Replication
● Snapshot
– Whole table replication
– Two tables w/ single view
● Brief exclusive lock to swap view source
– Ideal for small, or very infrequently changed tables
– Replicate column changes (new, dropped)
– No replication if source data has not changed
● Table
– Single table, no views
– Options to handle FK (cascade) and reset sequences
– Good for dev database
Types of Replication
● Incremental
– Control timestamp column
– High transaction tables w/ timestamp set every insert
– With primary/unique key, can also support updates
– DST
● Run database in GMT/UTC
● Replication does not run
Types of Replication
● DML
– Replay Inserts, Updates, Deletes
– Trigger w/ queue table on source
– Doesn't actually replay
● Queue table of only primary/unique key values
● Distinct on queue table
● Delete all matches on destination & re-insert
– Currently limited to one destination. Working on multiple destination
support.
Types of Replication
● Log Deletes
– Same methods as DML but does not replay deletes
– Common in data warehousing
– Destination has special column with timestamp of row's deletion
Use Cases
● Table audit
– Trigger to track all changes to audit table w/ audit_timestamp column
– Use incremental replication on audit table to pull to data warehouse
– Time-based partitioning on source audit table
● Database Upgrade
– Can connect with dblink to any version that supports it
– Setup replication for larger tables to minimize downtime for pg_dump
upgrade method
PG Partition Manager
● Current partition management is entirely manual
– http://www.postgresql.org/docs/current/static/ddl-partitioni
ng.html
● Custom write all tables, triggers, functions, rules, etc.
● Core devs working on getting it built in
● In the mean time ...
Automated Creation
● Time & Serial Based Partitioning
– Yearly, Quarterly, Monthly, Weekly, Daily, Hourly, ½ hour, ¼ hour
● Static & Dynamic Triggers
● Pre-creates partitions
● Manage child table properties from parent
– Indexes, constraints, defaults, privileges & ownership
● Automatically updates trigger functions as needed.
● Handles object name length limit (63 char)
Automated Creation
● Python script to partition existing data
● Commits after each partition created
● Commit in smaller batches with configured wait
● Partition live, production tables
– Partitioned 74 mil row table by day (30 days of data)
– Committed in hourly blocks w/ 5 second wait
– Streaming slave never fell more than 100 seconds behind
– 2-3 second lock on parent was only interruption
Static Partitioning
● Readable functions!
CREATE OR REPLACE FUNCTION partman_test.time_static_table_part_trig_func()
RETURNS trigger
LANGUAGE plpgsql
AS $function$
BEGIN
IF TG_OP = 'INSERT' THEN
IF NEW.col3 >= '2013-03-21 00:00:00-04' AND NEW.col3 < '2013-03-22 00:00:00-04' THEN
INSERT INTO partman_test.time_static_table_p2013_03_21 VALUES (NEW.*);
ELSIF NEW.col3 >= '2013-03-20 00:00:00-04' AND NEW.col3 < '2013-03-21 00:00:00-04' THEN
INSERT INTO partman_test.time_static_table_p2013_03_20 VALUES (NEW.*);
ELSIF NEW.col3 >= '2013-03-22 00:00:00-04' AND NEW.col3 < '2013-03-23 00:00:00-04' THEN
INSERT INTO partman_test.time_static_table_p2013_03_22 VALUES (NEW.*);
ELSIF NEW.col3 >= '2013-03-19 00:00:00-04' AND NEW.col3 < '2013-03-20 00:00:00-04' THEN
INSERT INTO partman_test.time_static_table_p2013_03_19 VALUES (NEW.*);
ELSIF NEW.col3 >= '2013-03-23 00:00:00-04' AND NEW.col3 < '2013-03-24 00:00:00-04' THEN
INSERT INTO partman_test.time_static_table_p2013_03_23 VALUES (NEW.*);
ELSE
RETURN NEW;
END IF;
END IF;
RETURN NULL;
END $function$
Dynamic Partitioning
CREATE OR REPLACE FUNCTION partman_test.time_dynamic_table_part_trig_func()
RETURNS trigger
LANGUAGE plpgsql
AS $function$
DECLARE
v_count int;
v_partition_name text;
v_partition_timestamp timestamptz;
BEGIN
IF TG_OP = 'INSERT' THEN
v_partition_timestamp := date_trunc('day', NEW.col3);
v_partition_name := partman.check_name_length('time_dynamic_table', 'partman_test',
to_char(v_partition_timestamp, 'YYYY_MM_DD'), TRUE);
SELECT count(*) INTO v_count FROM pg_tables WHERE schemaname ||'.'|| tablename = v_partition_name;
IF v_count > 0 THEN
EXECUTE 'INSERT INTO '||v_partition_name||' VALUES($1.*)' USING NEW;
ELSE
RETURN NEW;
END IF;
END IF;
RETURN NULL;
END $function$
Dynamic Partitioning
CREATE OR REPLACE FUNCTION partman_test.time_dynamic_table_part_trig_func()
RETURNS trigger
LANGUAGE plpgsql
AS $function$
DECLARE
v_count int;
v_partition_name text;
v_partition_timestamp timestamptz;
BEGIN
IF TG_OP = 'INSERT' THEN
v_partition_timestamp := date_trunc('day', NEW.col3);
v_partition_name := partman.check_name_length('time_dynamic_table', 'partman_test',
to_char(v_partition_timestamp, 'YYYY_MM_DD'), TRUE);
SELECT count(*) INTO v_count FROM pg_tables WHERE schemaname ||'.'|| tablename = v_partition_name;
IF v_count > 0 THEN
EXECUTE 'INSERT INTO '||v_partition_name||' VALUES($1.*)' USING NEW;
ELSE
RETURN NEW;
END IF;
END IF;
RETURN NULL;
END $function$
MAGIC
Automated Destruction
● Configurable retention policy
– Time: Drop tables with values older than 3 months
– Serial: Drop tables with values less than 1000 minus current max
● By default only uninherits
● Can drop old tables or only their indexes
● Python script to undo partitioning
– Can undo partitioning not made by pg_partman
● Python script to safely dump out old partitions
Links
● https://github.com/omniti-labs/pg_extractor
● https://github.com/omniti-labs/pg_jobmon
● https://github.com/omniti-labs/mimeo
● https://github.com/keithf4/pg_partman
● http://pgtap.org/ - Essential extension developer tool
http://www.omniti.com keith@omniti.com
http://www.keithf4.com @keithf4

Contenu connexe

Tendances

[PGDay.Seoul 2020] PostgreSQL 13 New Features
[PGDay.Seoul 2020] PostgreSQL 13 New Features[PGDay.Seoul 2020] PostgreSQL 13 New Features
[PGDay.Seoul 2020] PostgreSQL 13 New Featureshyeongchae lee
 
Troubleshooting PostgreSQL Streaming Replication
Troubleshooting PostgreSQL Streaming ReplicationTroubleshooting PostgreSQL Streaming Replication
Troubleshooting PostgreSQL Streaming ReplicationAlexey Lesovsky
 
SCALE 15x Minimizing PostgreSQL Major Version Upgrade Downtime
SCALE 15x Minimizing PostgreSQL Major Version Upgrade DowntimeSCALE 15x Minimizing PostgreSQL Major Version Upgrade Downtime
SCALE 15x Minimizing PostgreSQL Major Version Upgrade DowntimeJeff Frost
 
Postgresql Database Administration Basic - Day1
Postgresql  Database Administration Basic  - Day1Postgresql  Database Administration Basic  - Day1
Postgresql Database Administration Basic - Day1PoguttuezhiniVP
 
Deep dive into PostgreSQL statistics.
Deep dive into PostgreSQL statistics.Deep dive into PostgreSQL statistics.
Deep dive into PostgreSQL statistics.Alexey Lesovsky
 
Top 10 Mistakes When Migrating From Oracle to PostgreSQL
Top 10 Mistakes When Migrating From Oracle to PostgreSQLTop 10 Mistakes When Migrating From Oracle to PostgreSQL
Top 10 Mistakes When Migrating From Oracle to PostgreSQLJim Mlodgenski
 
Advanced backup methods (Postgres@CERN)
Advanced backup methods (Postgres@CERN)Advanced backup methods (Postgres@CERN)
Advanced backup methods (Postgres@CERN)Anastasia Lubennikova
 
Non-Relational Postgres / Bruce Momjian (EnterpriseDB)
Non-Relational Postgres / Bruce Momjian (EnterpriseDB)Non-Relational Postgres / Bruce Momjian (EnterpriseDB)
Non-Relational Postgres / Bruce Momjian (EnterpriseDB)Ontico
 
Postgresql Database Administration Basic - Day2
Postgresql  Database Administration Basic  - Day2Postgresql  Database Administration Basic  - Day2
Postgresql Database Administration Basic - Day2PoguttuezhiniVP
 
Troubleshooting PostgreSQL with pgCenter
Troubleshooting PostgreSQL with pgCenterTroubleshooting PostgreSQL with pgCenter
Troubleshooting PostgreSQL with pgCenterAlexey Lesovsky
 
pg_proctab: Accessing System Stats in PostgreSQL
pg_proctab: Accessing System Stats in PostgreSQLpg_proctab: Accessing System Stats in PostgreSQL
pg_proctab: Accessing System Stats in PostgreSQLMark Wong
 
Better Full Text Search in PostgreSQL
Better Full Text Search in PostgreSQLBetter Full Text Search in PostgreSQL
Better Full Text Search in PostgreSQLArtur Zakirov
 
PostgreSQL performance improvements in 9.5 and 9.6
PostgreSQL performance improvements in 9.5 and 9.6PostgreSQL performance improvements in 9.5 and 9.6
PostgreSQL performance improvements in 9.5 and 9.6Tomas Vondra
 
PostgreSQL Troubleshoot On-line, (RITfest 2015 meetup at Moscow, Russia).
PostgreSQL Troubleshoot On-line, (RITfest 2015 meetup at Moscow, Russia).PostgreSQL Troubleshoot On-line, (RITfest 2015 meetup at Moscow, Russia).
PostgreSQL Troubleshoot On-line, (RITfest 2015 meetup at Moscow, Russia).Alexey Lesovsky
 
pg_proctab: Accessing System Stats in PostgreSQL
pg_proctab: Accessing System Stats in PostgreSQLpg_proctab: Accessing System Stats in PostgreSQL
pg_proctab: Accessing System Stats in PostgreSQLMark Wong
 
MySQL 8.0 EXPLAIN ANALYZE
MySQL 8.0 EXPLAIN ANALYZEMySQL 8.0 EXPLAIN ANALYZE
MySQL 8.0 EXPLAIN ANALYZENorvald Ryeng
 
Automating Disaster Recovery PostgreSQL
Automating Disaster Recovery PostgreSQLAutomating Disaster Recovery PostgreSQL
Automating Disaster Recovery PostgreSQLNina Kaufman
 

Tendances (20)

[PGDay.Seoul 2020] PostgreSQL 13 New Features
[PGDay.Seoul 2020] PostgreSQL 13 New Features[PGDay.Seoul 2020] PostgreSQL 13 New Features
[PGDay.Seoul 2020] PostgreSQL 13 New Features
 
Troubleshooting PostgreSQL Streaming Replication
Troubleshooting PostgreSQL Streaming ReplicationTroubleshooting PostgreSQL Streaming Replication
Troubleshooting PostgreSQL Streaming Replication
 
SCALE 15x Minimizing PostgreSQL Major Version Upgrade Downtime
SCALE 15x Minimizing PostgreSQL Major Version Upgrade DowntimeSCALE 15x Minimizing PostgreSQL Major Version Upgrade Downtime
SCALE 15x Minimizing PostgreSQL Major Version Upgrade Downtime
 
Postgresql Database Administration Basic - Day1
Postgresql  Database Administration Basic  - Day1Postgresql  Database Administration Basic  - Day1
Postgresql Database Administration Basic - Day1
 
Deep dive into PostgreSQL statistics.
Deep dive into PostgreSQL statistics.Deep dive into PostgreSQL statistics.
Deep dive into PostgreSQL statistics.
 
Top 10 Mistakes When Migrating From Oracle to PostgreSQL
Top 10 Mistakes When Migrating From Oracle to PostgreSQLTop 10 Mistakes When Migrating From Oracle to PostgreSQL
Top 10 Mistakes When Migrating From Oracle to PostgreSQL
 
Pgcenter overview
Pgcenter overviewPgcenter overview
Pgcenter overview
 
Advanced backup methods (Postgres@CERN)
Advanced backup methods (Postgres@CERN)Advanced backup methods (Postgres@CERN)
Advanced backup methods (Postgres@CERN)
 
Non-Relational Postgres / Bruce Momjian (EnterpriseDB)
Non-Relational Postgres / Bruce Momjian (EnterpriseDB)Non-Relational Postgres / Bruce Momjian (EnterpriseDB)
Non-Relational Postgres / Bruce Momjian (EnterpriseDB)
 
PgconfSV compression
PgconfSV compressionPgconfSV compression
PgconfSV compression
 
Postgresql Database Administration Basic - Day2
Postgresql  Database Administration Basic  - Day2Postgresql  Database Administration Basic  - Day2
Postgresql Database Administration Basic - Day2
 
Full Text Search in PostgreSQL
Full Text Search in PostgreSQLFull Text Search in PostgreSQL
Full Text Search in PostgreSQL
 
Troubleshooting PostgreSQL with pgCenter
Troubleshooting PostgreSQL with pgCenterTroubleshooting PostgreSQL with pgCenter
Troubleshooting PostgreSQL with pgCenter
 
pg_proctab: Accessing System Stats in PostgreSQL
pg_proctab: Accessing System Stats in PostgreSQLpg_proctab: Accessing System Stats in PostgreSQL
pg_proctab: Accessing System Stats in PostgreSQL
 
Better Full Text Search in PostgreSQL
Better Full Text Search in PostgreSQLBetter Full Text Search in PostgreSQL
Better Full Text Search in PostgreSQL
 
PostgreSQL performance improvements in 9.5 and 9.6
PostgreSQL performance improvements in 9.5 and 9.6PostgreSQL performance improvements in 9.5 and 9.6
PostgreSQL performance improvements in 9.5 and 9.6
 
PostgreSQL Troubleshoot On-line, (RITfest 2015 meetup at Moscow, Russia).
PostgreSQL Troubleshoot On-line, (RITfest 2015 meetup at Moscow, Russia).PostgreSQL Troubleshoot On-line, (RITfest 2015 meetup at Moscow, Russia).
PostgreSQL Troubleshoot On-line, (RITfest 2015 meetup at Moscow, Russia).
 
pg_proctab: Accessing System Stats in PostgreSQL
pg_proctab: Accessing System Stats in PostgreSQLpg_proctab: Accessing System Stats in PostgreSQL
pg_proctab: Accessing System Stats in PostgreSQL
 
MySQL 8.0 EXPLAIN ANALYZE
MySQL 8.0 EXPLAIN ANALYZEMySQL 8.0 EXPLAIN ANALYZE
MySQL 8.0 EXPLAIN ANALYZE
 
Automating Disaster Recovery PostgreSQL
Automating Disaster Recovery PostgreSQLAutomating Disaster Recovery PostgreSQL
Automating Disaster Recovery PostgreSQL
 

En vedette

Kevin Kempter - PostgreSQL Backup and Recovery Methods @ Postgres Open
Kevin Kempter - PostgreSQL Backup and Recovery Methods @ Postgres OpenKevin Kempter - PostgreSQL Backup and Recovery Methods @ Postgres Open
Kevin Kempter - PostgreSQL Backup and Recovery Methods @ Postgres OpenPostgresOpen
 
Ryan Jarvinen Open Shift Talk @ Postgres Open 2013
Ryan Jarvinen Open Shift Talk @ Postgres Open 2013Ryan Jarvinen Open Shift Talk @ Postgres Open 2013
Ryan Jarvinen Open Shift Talk @ Postgres Open 2013PostgresOpen
 
David Keeney - SQL Database Server Requests from the Browser @ Postgres Open
David Keeney - SQL Database Server Requests from the Browser @ Postgres OpenDavid Keeney - SQL Database Server Requests from the Browser @ Postgres Open
David Keeney - SQL Database Server Requests from the Browser @ Postgres OpenPostgresOpen
 
Gurjeet Singh - How Postgres is Different From (Better Tha) Your RDBMS @ Post...
Gurjeet Singh - How Postgres is Different From (Better Tha) Your RDBMS @ Post...Gurjeet Singh - How Postgres is Different From (Better Tha) Your RDBMS @ Post...
Gurjeet Singh - How Postgres is Different From (Better Tha) Your RDBMS @ Post...PostgresOpen
 
Selena Deckelmann - Sane Schema Management with Alembic and SQLAlchemy @ Pos...
Selena Deckelmann - Sane Schema Management with  Alembic and SQLAlchemy @ Pos...Selena Deckelmann - Sane Schema Management with  Alembic and SQLAlchemy @ Pos...
Selena Deckelmann - Sane Schema Management with Alembic and SQLAlchemy @ Pos...PostgresOpen
 
Henrietta Dombrovskaya - A New Approach to Resolve Object-Relational Impedanc...
Henrietta Dombrovskaya - A New Approach to Resolve Object-Relational Impedanc...Henrietta Dombrovskaya - A New Approach to Resolve Object-Relational Impedanc...
Henrietta Dombrovskaya - A New Approach to Resolve Object-Relational Impedanc...PostgresOpen
 
Keith Paskett - Postgres on ZFS @ Postgres Open
Keith Paskett - Postgres on ZFS @ Postgres OpenKeith Paskett - Postgres on ZFS @ Postgres Open
Keith Paskett - Postgres on ZFS @ Postgres OpenPostgresOpen
 
Islamabad PUG - 7th Meetup - performance tuning
Islamabad PUG - 7th Meetup - performance tuningIslamabad PUG - 7th Meetup - performance tuning
Islamabad PUG - 7th Meetup - performance tuningUmair Shahid
 
Islamabad PUG - 7th meetup - performance tuning
Islamabad PUG - 7th meetup - performance tuningIslamabad PUG - 7th meetup - performance tuning
Islamabad PUG - 7th meetup - performance tuningUmair Shahid
 
Robert Haas Query Planning Gone Wrong Presentation @ Postgres Open
Robert Haas Query Planning Gone Wrong Presentation @ Postgres OpenRobert Haas Query Planning Gone Wrong Presentation @ Postgres Open
Robert Haas Query Planning Gone Wrong Presentation @ Postgres OpenPostgresOpen
 
Out of the box replication in postgres 9.4(pg confus)
Out of the box replication in postgres 9.4(pg confus)Out of the box replication in postgres 9.4(pg confus)
Out of the box replication in postgres 9.4(pg confus)Denish Patel
 
Steve Singer - Managing PostgreSQL with Puppet @ Postgres Open
Steve Singer - Managing PostgreSQL with Puppet @ Postgres OpenSteve Singer - Managing PostgreSQL with Puppet @ Postgres Open
Steve Singer - Managing PostgreSQL with Puppet @ Postgres OpenPostgresOpen
 
Michael Bayer Introduction to SQLAlchemy @ Postgres Open
Michael Bayer Introduction to SQLAlchemy @ Postgres OpenMichael Bayer Introduction to SQLAlchemy @ Postgres Open
Michael Bayer Introduction to SQLAlchemy @ Postgres OpenPostgresOpen
 
PoPostgreSQL Web Projects: From Start to FinishStart To Finish
PoPostgreSQL Web Projects: From Start to FinishStart To FinishPoPostgreSQL Web Projects: From Start to FinishStart To Finish
PoPostgreSQL Web Projects: From Start to FinishStart To Finishelliando dias
 
Koichi Suzuki - Postgres-XC Dynamic Cluster Management @ Postgres Open
Koichi Suzuki - Postgres-XC Dynamic Cluster  Management @ Postgres OpenKoichi Suzuki - Postgres-XC Dynamic Cluster  Management @ Postgres Open
Koichi Suzuki - Postgres-XC Dynamic Cluster Management @ Postgres OpenPostgresOpen
 
Gbroccolo pgconfeu2016 pgnfs
Gbroccolo pgconfeu2016 pgnfsGbroccolo pgconfeu2016 pgnfs
Gbroccolo pgconfeu2016 pgnfsGiuseppe Broccolo
 
PostgreSQL HA
PostgreSQL   HAPostgreSQL   HA
PostgreSQL HAharoonm
 
Michael Paquier - Taking advantage of custom bgworkers @ Postgres Open
Michael Paquier - Taking advantage of custom bgworkers @ Postgres OpenMichael Paquier - Taking advantage of custom bgworkers @ Postgres Open
Michael Paquier - Taking advantage of custom bgworkers @ Postgres OpenPostgresOpen
 
PostgreSQL replication from setup to advanced features.
 PostgreSQL replication from setup to advanced features. PostgreSQL replication from setup to advanced features.
PostgreSQL replication from setup to advanced features.Pivorak MeetUp
 

En vedette (20)

Kevin Kempter - PostgreSQL Backup and Recovery Methods @ Postgres Open
Kevin Kempter - PostgreSQL Backup and Recovery Methods @ Postgres OpenKevin Kempter - PostgreSQL Backup and Recovery Methods @ Postgres Open
Kevin Kempter - PostgreSQL Backup and Recovery Methods @ Postgres Open
 
Ryan Jarvinen Open Shift Talk @ Postgres Open 2013
Ryan Jarvinen Open Shift Talk @ Postgres Open 2013Ryan Jarvinen Open Shift Talk @ Postgres Open 2013
Ryan Jarvinen Open Shift Talk @ Postgres Open 2013
 
David Keeney - SQL Database Server Requests from the Browser @ Postgres Open
David Keeney - SQL Database Server Requests from the Browser @ Postgres OpenDavid Keeney - SQL Database Server Requests from the Browser @ Postgres Open
David Keeney - SQL Database Server Requests from the Browser @ Postgres Open
 
Gurjeet Singh - How Postgres is Different From (Better Tha) Your RDBMS @ Post...
Gurjeet Singh - How Postgres is Different From (Better Tha) Your RDBMS @ Post...Gurjeet Singh - How Postgres is Different From (Better Tha) Your RDBMS @ Post...
Gurjeet Singh - How Postgres is Different From (Better Tha) Your RDBMS @ Post...
 
Selena Deckelmann - Sane Schema Management with Alembic and SQLAlchemy @ Pos...
Selena Deckelmann - Sane Schema Management with  Alembic and SQLAlchemy @ Pos...Selena Deckelmann - Sane Schema Management with  Alembic and SQLAlchemy @ Pos...
Selena Deckelmann - Sane Schema Management with Alembic and SQLAlchemy @ Pos...
 
Henrietta Dombrovskaya - A New Approach to Resolve Object-Relational Impedanc...
Henrietta Dombrovskaya - A New Approach to Resolve Object-Relational Impedanc...Henrietta Dombrovskaya - A New Approach to Resolve Object-Relational Impedanc...
Henrietta Dombrovskaya - A New Approach to Resolve Object-Relational Impedanc...
 
Keith Paskett - Postgres on ZFS @ Postgres Open
Keith Paskett - Postgres on ZFS @ Postgres OpenKeith Paskett - Postgres on ZFS @ Postgres Open
Keith Paskett - Postgres on ZFS @ Postgres Open
 
Islamabad PUG - 7th Meetup - performance tuning
Islamabad PUG - 7th Meetup - performance tuningIslamabad PUG - 7th Meetup - performance tuning
Islamabad PUG - 7th Meetup - performance tuning
 
Islamabad PUG - 7th meetup - performance tuning
Islamabad PUG - 7th meetup - performance tuningIslamabad PUG - 7th meetup - performance tuning
Islamabad PUG - 7th meetup - performance tuning
 
Robert Haas Query Planning Gone Wrong Presentation @ Postgres Open
Robert Haas Query Planning Gone Wrong Presentation @ Postgres OpenRobert Haas Query Planning Gone Wrong Presentation @ Postgres Open
Robert Haas Query Planning Gone Wrong Presentation @ Postgres Open
 
Out of the box replication in postgres 9.4(pg confus)
Out of the box replication in postgres 9.4(pg confus)Out of the box replication in postgres 9.4(pg confus)
Out of the box replication in postgres 9.4(pg confus)
 
Steve Singer - Managing PostgreSQL with Puppet @ Postgres Open
Steve Singer - Managing PostgreSQL with Puppet @ Postgres OpenSteve Singer - Managing PostgreSQL with Puppet @ Postgres Open
Steve Singer - Managing PostgreSQL with Puppet @ Postgres Open
 
Michael Bayer Introduction to SQLAlchemy @ Postgres Open
Michael Bayer Introduction to SQLAlchemy @ Postgres OpenMichael Bayer Introduction to SQLAlchemy @ Postgres Open
Michael Bayer Introduction to SQLAlchemy @ Postgres Open
 
PoPostgreSQL Web Projects: From Start to FinishStart To Finish
PoPostgreSQL Web Projects: From Start to FinishStart To FinishPoPostgreSQL Web Projects: From Start to FinishStart To Finish
PoPostgreSQL Web Projects: From Start to FinishStart To Finish
 
Koichi Suzuki - Postgres-XC Dynamic Cluster Management @ Postgres Open
Koichi Suzuki - Postgres-XC Dynamic Cluster  Management @ Postgres OpenKoichi Suzuki - Postgres-XC Dynamic Cluster  Management @ Postgres Open
Koichi Suzuki - Postgres-XC Dynamic Cluster Management @ Postgres Open
 
Gbroccolo pgconfeu2016 pgnfs
Gbroccolo pgconfeu2016 pgnfsGbroccolo pgconfeu2016 pgnfs
Gbroccolo pgconfeu2016 pgnfs
 
PostgreSQL HA
PostgreSQL   HAPostgreSQL   HA
PostgreSQL HA
 
Michael Paquier - Taking advantage of custom bgworkers @ Postgres Open
Michael Paquier - Taking advantage of custom bgworkers @ Postgres OpenMichael Paquier - Taking advantage of custom bgworkers @ Postgres Open
Michael Paquier - Taking advantage of custom bgworkers @ Postgres Open
 
Geometria Projetiva
Geometria ProjetivaGeometria Projetiva
Geometria Projetiva
 
PostgreSQL replication from setup to advanced features.
 PostgreSQL replication from setup to advanced features. PostgreSQL replication from setup to advanced features.
PostgreSQL replication from setup to advanced features.
 

Similaire à Keith Fiske - When PostgreSQL Can't, You Can @ Postgres Open

LVOUG meetup #4 - Case Study 10g to 11g
LVOUG meetup #4 - Case Study 10g to 11gLVOUG meetup #4 - Case Study 10g to 11g
LVOUG meetup #4 - Case Study 10g to 11gMaris Elsins
 
NoCOUG_201411_Patel_Managing_a_Large_OLTP_Database
NoCOUG_201411_Patel_Managing_a_Large_OLTP_DatabaseNoCOUG_201411_Patel_Managing_a_Large_OLTP_Database
NoCOUG_201411_Patel_Managing_a_Large_OLTP_DatabaseParesh Patel
 
Oracle to Postgres Migration - part 2
Oracle to Postgres Migration - part 2Oracle to Postgres Migration - part 2
Oracle to Postgres Migration - part 2PgTraining
 
What’s New In PostgreSQL 9.3
What’s New In PostgreSQL 9.3What’s New In PostgreSQL 9.3
What’s New In PostgreSQL 9.3Pavan Deolasee
 
Bgoug 2019.11 test your pl sql - not your patience
Bgoug 2019.11   test your pl sql - not your patienceBgoug 2019.11   test your pl sql - not your patience
Bgoug 2019.11 test your pl sql - not your patienceJacek Gebal
 
Webinar - MariaDB Temporal Tables: a demonstration
Webinar - MariaDB Temporal Tables: a demonstrationWebinar - MariaDB Temporal Tables: a demonstration
Webinar - MariaDB Temporal Tables: a demonstrationFederico Razzoli
 
POUG2019 - Test your PL/SQL - your database will love you
POUG2019 - Test your PL/SQL - your database will love youPOUG2019 - Test your PL/SQL - your database will love you
POUG2019 - Test your PL/SQL - your database will love youJacek Gebal
 
PuppetConf 2016: An Introduction to Measuring and Tuning PE Performance – Cha...
PuppetConf 2016: An Introduction to Measuring and Tuning PE Performance – Cha...PuppetConf 2016: An Introduction to Measuring and Tuning PE Performance – Cha...
PuppetConf 2016: An Introduction to Measuring and Tuning PE Performance – Cha...Puppet
 
Upgrade to MySQL 5.6 without downtime
Upgrade to MySQL 5.6 without downtimeUpgrade to MySQL 5.6 without downtime
Upgrade to MySQL 5.6 without downtimeOlivier DASINI
 
PostgreSQL WAL for DBAs
PostgreSQL WAL for DBAs PostgreSQL WAL for DBAs
PostgreSQL WAL for DBAs PGConf APAC
 
What is happening now
What is happening nowWhat is happening now
What is happening nowDreamMalar
 

Similaire à Keith Fiske - When PostgreSQL Can't, You Can @ Postgres Open (20)

AutoDOPandRest
AutoDOPandRestAutoDOPandRest
AutoDOPandRest
 
LVOUG meetup #4 - Case Study 10g to 11g
LVOUG meetup #4 - Case Study 10g to 11gLVOUG meetup #4 - Case Study 10g to 11g
LVOUG meetup #4 - Case Study 10g to 11g
 
NoCOUG_201411_Patel_Managing_a_Large_OLTP_Database
NoCOUG_201411_Patel_Managing_a_Large_OLTP_DatabaseNoCOUG_201411_Patel_Managing_a_Large_OLTP_Database
NoCOUG_201411_Patel_Managing_a_Large_OLTP_Database
 
Foss4 guk2016 aileenheal
Foss4 guk2016 aileenhealFoss4 guk2016 aileenheal
Foss4 guk2016 aileenheal
 
Oracle to Postgres Migration - part 2
Oracle to Postgres Migration - part 2Oracle to Postgres Migration - part 2
Oracle to Postgres Migration - part 2
 
What’s New In PostgreSQL 9.3
What’s New In PostgreSQL 9.3What’s New In PostgreSQL 9.3
What’s New In PostgreSQL 9.3
 
Free oracle performance tools
Free oracle performance toolsFree oracle performance tools
Free oracle performance tools
 
8.4 Upcoming Features
8.4 Upcoming Features 8.4 Upcoming Features
8.4 Upcoming Features
 
Bgoug 2019.11 test your pl sql - not your patience
Bgoug 2019.11   test your pl sql - not your patienceBgoug 2019.11   test your pl sql - not your patience
Bgoug 2019.11 test your pl sql - not your patience
 
11gR2 Upgrade.pdf
11gR2 Upgrade.pdf11gR2 Upgrade.pdf
11gR2 Upgrade.pdf
 
11gR2 Upgrade.pdf
11gR2 Upgrade.pdf11gR2 Upgrade.pdf
11gR2 Upgrade.pdf
 
Webinar - MariaDB Temporal Tables: a demonstration
Webinar - MariaDB Temporal Tables: a demonstrationWebinar - MariaDB Temporal Tables: a demonstration
Webinar - MariaDB Temporal Tables: a demonstration
 
POUG2019 - Test your PL/SQL - your database will love you
POUG2019 - Test your PL/SQL - your database will love youPOUG2019 - Test your PL/SQL - your database will love you
POUG2019 - Test your PL/SQL - your database will love you
 
PuppetConf 2016: An Introduction to Measuring and Tuning PE Performance – Cha...
PuppetConf 2016: An Introduction to Measuring and Tuning PE Performance – Cha...PuppetConf 2016: An Introduction to Measuring and Tuning PE Performance – Cha...
PuppetConf 2016: An Introduction to Measuring and Tuning PE Performance – Cha...
 
Upgrade to MySQL 5.6 without downtime
Upgrade to MySQL 5.6 without downtimeUpgrade to MySQL 5.6 without downtime
Upgrade to MySQL 5.6 without downtime
 
PostgreSQL WAL for DBAs
PostgreSQL WAL for DBAs PostgreSQL WAL for DBAs
PostgreSQL WAL for DBAs
 
How about now
How about nowHow about now
How about now
 
sssss
ssssssssss
sssss
 
ttfhy
ttfhyttfhy
ttfhy
 
What is happening now
What is happening nowWhat is happening now
What is happening now
 

Dernier

Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Scott Keck-Warren
 
My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationMy Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationRidwan Fadjar
 
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024BookNet Canada
 
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)Wonjun Hwang
 
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticsKotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticscarlostorres15106
 
Install Stable Diffusion in windows machine
Install Stable Diffusion in windows machineInstall Stable Diffusion in windows machine
Install Stable Diffusion in windows machinePadma Pradeep
 
Powerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time ClashPowerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time Clashcharlottematthew16
 
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks..."LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...Fwdays
 
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024BookNet Canada
 
Story boards and shot lists for my a level piece
Story boards and shot lists for my a level pieceStory boards and shot lists for my a level piece
Story boards and shot lists for my a level piececharlottematthew16
 
Unleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubUnleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubKalema Edgar
 
Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!Manik S Magar
 
Dev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebDev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebUiPathCommunity
 
Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationBeyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationSafe Software
 
Vertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering TipsVertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering TipsMiki Katsuragi
 
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek SchlawackFwdays
 
DevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenDevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenHervé Boutemy
 
Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Commit University
 
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage CostLeverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage CostZilliz
 
"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr BaganFwdays
 

Dernier (20)

Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024
 
My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationMy Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 Presentation
 
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
 
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
 
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticsKotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
 
Install Stable Diffusion in windows machine
Install Stable Diffusion in windows machineInstall Stable Diffusion in windows machine
Install Stable Diffusion in windows machine
 
Powerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time ClashPowerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time Clash
 
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks..."LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
 
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
 
Story boards and shot lists for my a level piece
Story boards and shot lists for my a level pieceStory boards and shot lists for my a level piece
Story boards and shot lists for my a level piece
 
Unleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubUnleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding Club
 
Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!
 
Dev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebDev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio Web
 
Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationBeyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
 
Vertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering TipsVertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering Tips
 
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
 
DevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenDevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache Maven
 
Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!
 
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage CostLeverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
 
"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan
 

Keith Fiske - When PostgreSQL Can't, You Can @ Postgres Open

  • 1. When PostgreSQL Can't, You Can ● Keith Fiske ● DBA @ OmniTI http://www.omniti.com keith@omniti.com http://www.keithf4.com @keithf4
  • 2. OmniTI, Inc ● Full-stack support for high-traffic websites & applications – Millions of users – Terabytes of data ● Surge Conference - http://omniti.com/surge – Disaster Porn – Annually in Sept (just last week) ● We're hiring!
  • 3. PostgreSQL Can't ● Dump filtering ● Autonomous Functions ● Logical Replication ● Partition Management
  • 4. PG Extractor ● pg_dump limitations (-t, -n) ● Filter by schema, table, view, function, sequence, type, trigger, owner ● Dumps each database object to its own file in organized folders ● Use regex matching ● Limited integration with SVN & Git
  • 5. Extensions ● Introduced in 9.1 ● Logically grouped set of database objects – CREATE EXTENSION pg_partman; ● Versioned – ALTER EXTENSION pg_partman UPDATE TO '1.4.0'; – Update and revert changes predictably. ● All following extensions are done in PL/PGSQL – Extremely easy to get you're code installed and managed by the database.
  • 6. PG Job Monitor (pg_jobmon) ● Autonomous functions ● Log steps of running function ● Monitors logged functions to ensure they complete ● If/when they fail, where and why
  • 7. PG Jobmon add_job('job name'); add_step(job_id, 'What this step will do'); … do some stuff... update_step(step_id, 'good_status', 'What this step did successfully'); add_step(job_id, 'What this next step will do'); ...do some stuff in a loop... update_step(step_id, 'good_status', 'update every loop iteration to track progress'); add_step(job_id, 'One last step'); … do just a bit more stuff... update_step(step_id, 'good_status', 'Job finished ok'); close_job(job_id); EXCEPTION WHEN OTHERS THEN update_step(step_id, 'bad_status', 'Uh..oh...: '||coalesce(SQLERRM,'wat')); fail_job(job_id);
  • 8. PG Jobmon show_job('my job name', [int]); -[ RECORD 3 ]----------------------------- job_id | 10 owner | keith job_name | PG_JOBMON TEST BAD JOB start_time | 2012-09-15 00:55:44.742176-04 end_time | 2012-09-15 00:55:44.851514-04 status | CRITICAL pid | 5848 -[ RECORD 4 ]----------------------------- job_id | 9 owner | keith job_name | PG_JOBMON TEST GOOD JOB start_time | 2012-09-15 00:55:44.293575-04 end_time | 2012-09-15 00:55:44.725483-04 status | OK pid | 5848 show_job_like('I forgot my job's whole name', [int]); show_detail(job_id); show_detail('job_name', [int]); show_job_status('bad_status', [int]); show_job_status('job name', 'status', [int]); show_running([int]); -[ RECORD 1 ]+------------------------------ job_id | 9 step_id | 19 action | Test step 1 start_time | 2012-09-15 00:55:44.501825-04 end_time | 2012-09-15 00:55:44.593389-04 elapsed_time | 0.091564 status | OK message | Successful Step 1 -[ RECORD 2 ]+------------------------------ job_id | 9 step_id | 20 action | Test step 2 start_time | 2012-09-15 00:55:44.643017-04 end_time | 2012-09-15 00:55:44.659336-04 elapsed_time | 0.016319 status | OK message | Rows affected: 2 -[ RECORD 3 ]+------------------------------ job_id | 9 step_id | 21 action | Test step 3 start_time | 2012-09-15 00:55:44.692518-04 end_time | 2012-09-15 00:55:44.7087-04 elapsed_time | 0.016182 status | OK message | Successful Step 3
  • 9. PG Jobmon check_job_status(); ● Make nagios check (command and service configs on my blog) ● Shameless plug – http://circonus.com (howto on my blog) SELECT t.alert_text || c.alert_text AS alert_status FROM jobmon.check_job_status() c JOIN jobmon.job_status_text t ON c.alert_code = t.alert_code; alert_status ------------------------------- OK(All jobs run successfully) alert_status -------------------------------------------------------------- CRITICAL(KEITH.SOME_OTHER_PROCESS: MISSING - Last run at 2012-09-13 07:17:07.86378-04; KEITH.ANOTHER_PROCESS: MISSING - Last run at 2012-09-13 07:16:30.169683-04;) alert_status -------------------------------------------------------------- WARNING(KEITH.SOME_CRITICAL_PROCESS: RUNNING; )
  • 10. Mimeo Logical (per-table) Replication Extension “The stencil duplicator or mimeograph machine (often abbreviated to mimeo) is a low-cost printing press that works by forcing ink through a stencil onto paper...Mimeographs were a common technology in printing small quantities, as in office work, classroom materials, and church bulletins.” – Wikipedia
  • 11. Mimeo ● Streaming & Log Shipping Replication (omnipitr) ● Per-table replication – Snapshot – Incremental – DML ● Quick replication setup and tear-down ● Installed & run from destination database ● No superuser required ● Advanced options (column filter, where condition) ● Monitor & Audit Trail w/ PG Jobmon
  • 12. Types of Replication ● Snapshot – Whole table replication – Two tables w/ single view ● Brief exclusive lock to swap view source – Ideal for small, or very infrequently changed tables – Replicate column changes (new, dropped) – No replication if source data has not changed ● Table – Single table, no views – Options to handle FK (cascade) and reset sequences – Good for dev database
  • 13. Types of Replication ● Incremental – Control timestamp column – High transaction tables w/ timestamp set every insert – With primary/unique key, can also support updates – DST ● Run database in GMT/UTC ● Replication does not run
  • 14. Types of Replication ● DML – Replay Inserts, Updates, Deletes – Trigger w/ queue table on source – Doesn't actually replay ● Queue table of only primary/unique key values ● Distinct on queue table ● Delete all matches on destination & re-insert – Currently limited to one destination. Working on multiple destination support.
  • 15. Types of Replication ● Log Deletes – Same methods as DML but does not replay deletes – Common in data warehousing – Destination has special column with timestamp of row's deletion
  • 16. Use Cases ● Table audit – Trigger to track all changes to audit table w/ audit_timestamp column – Use incremental replication on audit table to pull to data warehouse – Time-based partitioning on source audit table ● Database Upgrade – Can connect with dblink to any version that supports it – Setup replication for larger tables to minimize downtime for pg_dump upgrade method
  • 17. PG Partition Manager ● Current partition management is entirely manual – http://www.postgresql.org/docs/current/static/ddl-partitioni ng.html ● Custom write all tables, triggers, functions, rules, etc. ● Core devs working on getting it built in ● In the mean time ...
  • 18. Automated Creation ● Time & Serial Based Partitioning – Yearly, Quarterly, Monthly, Weekly, Daily, Hourly, ½ hour, ¼ hour ● Static & Dynamic Triggers ● Pre-creates partitions ● Manage child table properties from parent – Indexes, constraints, defaults, privileges & ownership ● Automatically updates trigger functions as needed. ● Handles object name length limit (63 char)
  • 19. Automated Creation ● Python script to partition existing data ● Commits after each partition created ● Commit in smaller batches with configured wait ● Partition live, production tables – Partitioned 74 mil row table by day (30 days of data) – Committed in hourly blocks w/ 5 second wait – Streaming slave never fell more than 100 seconds behind – 2-3 second lock on parent was only interruption
  • 20. Static Partitioning ● Readable functions! CREATE OR REPLACE FUNCTION partman_test.time_static_table_part_trig_func() RETURNS trigger LANGUAGE plpgsql AS $function$ BEGIN IF TG_OP = 'INSERT' THEN IF NEW.col3 >= '2013-03-21 00:00:00-04' AND NEW.col3 < '2013-03-22 00:00:00-04' THEN INSERT INTO partman_test.time_static_table_p2013_03_21 VALUES (NEW.*); ELSIF NEW.col3 >= '2013-03-20 00:00:00-04' AND NEW.col3 < '2013-03-21 00:00:00-04' THEN INSERT INTO partman_test.time_static_table_p2013_03_20 VALUES (NEW.*); ELSIF NEW.col3 >= '2013-03-22 00:00:00-04' AND NEW.col3 < '2013-03-23 00:00:00-04' THEN INSERT INTO partman_test.time_static_table_p2013_03_22 VALUES (NEW.*); ELSIF NEW.col3 >= '2013-03-19 00:00:00-04' AND NEW.col3 < '2013-03-20 00:00:00-04' THEN INSERT INTO partman_test.time_static_table_p2013_03_19 VALUES (NEW.*); ELSIF NEW.col3 >= '2013-03-23 00:00:00-04' AND NEW.col3 < '2013-03-24 00:00:00-04' THEN INSERT INTO partman_test.time_static_table_p2013_03_23 VALUES (NEW.*); ELSE RETURN NEW; END IF; END IF; RETURN NULL; END $function$
  • 21. Dynamic Partitioning CREATE OR REPLACE FUNCTION partman_test.time_dynamic_table_part_trig_func() RETURNS trigger LANGUAGE plpgsql AS $function$ DECLARE v_count int; v_partition_name text; v_partition_timestamp timestamptz; BEGIN IF TG_OP = 'INSERT' THEN v_partition_timestamp := date_trunc('day', NEW.col3); v_partition_name := partman.check_name_length('time_dynamic_table', 'partman_test', to_char(v_partition_timestamp, 'YYYY_MM_DD'), TRUE); SELECT count(*) INTO v_count FROM pg_tables WHERE schemaname ||'.'|| tablename = v_partition_name; IF v_count > 0 THEN EXECUTE 'INSERT INTO '||v_partition_name||' VALUES($1.*)' USING NEW; ELSE RETURN NEW; END IF; END IF; RETURN NULL; END $function$
  • 22. Dynamic Partitioning CREATE OR REPLACE FUNCTION partman_test.time_dynamic_table_part_trig_func() RETURNS trigger LANGUAGE plpgsql AS $function$ DECLARE v_count int; v_partition_name text; v_partition_timestamp timestamptz; BEGIN IF TG_OP = 'INSERT' THEN v_partition_timestamp := date_trunc('day', NEW.col3); v_partition_name := partman.check_name_length('time_dynamic_table', 'partman_test', to_char(v_partition_timestamp, 'YYYY_MM_DD'), TRUE); SELECT count(*) INTO v_count FROM pg_tables WHERE schemaname ||'.'|| tablename = v_partition_name; IF v_count > 0 THEN EXECUTE 'INSERT INTO '||v_partition_name||' VALUES($1.*)' USING NEW; ELSE RETURN NEW; END IF; END IF; RETURN NULL; END $function$ MAGIC
  • 23. Automated Destruction ● Configurable retention policy – Time: Drop tables with values older than 3 months – Serial: Drop tables with values less than 1000 minus current max ● By default only uninherits ● Can drop old tables or only their indexes ● Python script to undo partitioning – Can undo partitioning not made by pg_partman ● Python script to safely dump out old partitions
  • 24. Links ● https://github.com/omniti-labs/pg_extractor ● https://github.com/omniti-labs/pg_jobmon ● https://github.com/omniti-labs/mimeo ● https://github.com/keithf4/pg_partman ● http://pgtap.org/ - Essential extension developer tool http://www.omniti.com keith@omniti.com http://www.keithf4.com @keithf4