SlideShare a Scribd company logo
1 of 25
Download to read offline
From	Startup	to	Mature	Company:	
jashmead@nistica.com
1
PostgreSQL	Tips		
&	Techniques
ÊWavelength Selective Switches (WSS)☑
Agile Optical Networks
2
MSAN 10Gbà
100Gb
LOCAL HD
DISTRIBUTION
IPDSLAM
IPDSLAM
Data Center
Access Metro Edge Metro Core Long-Haul
**
Æ Ê
Ê
☑ ☑
☑
☑
CRITICAL BUILDING BLOCKS à AGILE OPTICAL NETWORKS
Tunable Pluggable Lasers
* Optical Channel Monitors (OCM)
Agile Optical Networks
☑
☑
3
INPUT EXPRESS
DROP
1x2		WSS
1) Automated routing of individual channels
– Reconfigurable Optical Add-Drop Mux
(ROADM)
2) Dynamic channel power management
– Allows long distance transmission
3) Integrated optical channel monitoring
– Information feedback for power
management
Wavelength Selective Switch (WSS)
What is a Zeppelin?
jashmead@nistica.com 4
•Manufacturing	
Database	
•Drives	manufacture	via	
automated	checklists	
•Work	flow	management		
•Training	checks	
•Module	data	
•Customer	datasheets	
•Process	engineering
Checklist Manifesto
• Getting	the	basics	
right	
• Every	time	
• In	ICU,	5	steps	to	
insert	line	
• Infection	rate	from	
11%	to	0
jashmead@nistica.com 5
How to design a database
• Listen	to	the	client	talk	about	their	business	
• Where	they	use	nouns,	use	tables.	
• Where	they	use	verbs,	use	functions.	
• Turn	their	adjectives	into	columns,	
• and	their	adverbs	into	the	parameters	for	
the	functions.
jashmead@nistica.com 6
It’s about the relationships
• Like	nouns,	tables	
only	valuable	in	
combination	
• Foreign	keys	
• Bones	and	
tendons	
• Documentation	
• Performance
jashmead@nistica.com 7
Keys are primary
• Anonymous	
• Natural	keys	
• Sequences	
• Fast	enough	for	
temp	tables	
• And	can	set	
ranges	in	useful	
ways
jashmead@nistica.com 8
CREATE SEQUENCE
serials_id_seq
START WITH
1000000000
INCREMENT BY 1
MINVALUE
1000000000
MAXVALUE
1249999999
CACHE 1;
Timestamps — Or where on the planet are we?
jashmead@nistica.com 9
Time to pull the trigger
• Timestamps	
• Keep	scope	
limited	
• Complex	
validation	
• History	
• Error	trapping
jashmead@nistica.com 10
CREATE TRIGGER
serials_timestamp
BEFORE UPDATE ON
serials FOR EACH ROW
EXECUTE PROCEDURE
timestamp_trg();
CREATE FUNCTION timestamp_trg() RETURNS trigger
LANGUAGE plpgsql
AS $$
begin
/*
force timestamps
-- created_at & updated_at fields exist
-- set Model.record_timestamps = false;
-- this keeps ActiveRecord from trying to do the
update
*/
if new.created_at is null
then
new.created_at = now();
end if;
new.updated_at = now();
return new;
end;
$$;
Stored Procedures - Muscles of a Database
jashmead@nistica.com 11
Staying true to type
•Rich	type	system	
•Induced	types	
•Defined	domains	
•Conversions	
•General	functions
jashmead@nistica.com 12
CREATE FUNCTION
sn_process(sn0 sn_t, stuff
description_t)
LANGUAGE plpgsql
AS $$
declare
sn1 sn_t;
serial_id1 serials.id
%type;
top_serial_id1
serials.id%type;
begin
Metadata
jashmead@nistica.com 13
select a.attname
from pg_catalog.pg_attribute a,
pg_catalog.pg_class c,
pg_catalog.pg_namespace n
where a.attrelid = c.oid
and c.relnamespace = n.oid
and c.relname = ?
and n.nspname = 'public'
and a.attnum > 0 -- gets rid
of internal columns
and a.attisdropped = 'f'
order by a.attnum
Model-View-Controller
jashmead@nistica.com 14
It’s about the conversation
jashmead@nistica.com 15
•KISS	
•Separation	
of	concerns	
•DRY	
•Right	tool	
•Local	
standards
JSON
jashmead@nistica.com 16
response = {
"result": "OK",
"number_of_serials": 3,
"message": "We found three
serials",
"serials": [ "SN1", "SN2",
"SN3" ],
"details": {
"retrieved_on": "2018-01-01
03:17:04",
"length": 1003
}
}
•Compact	
•Easy	to	
read	
•Native	in	
PostgreSQL	
•Frozen	
JavaScript
Crash reporting
• No	exceptions	
• Be	specific	
• Leave	log	
entry	
• Notify	IT	
• Tell	the	user	
what	to	do	
next
jashmead@nistica.com 17
Death to Yellow Stickies
jashmead@nistica.com 18
Start with the help
jashmead@nistica.com 19
I have a syncing feeling about this…
•Hub	&	spokes	
•Technical	
problems	
•Push	model	
•Positive	
verification	
required!
jashmead@nistica.com 20
2B or Not 2B
•Engineering	DB	
in	SQL	Server	
•2B	or	Not	2B	
•LATIN1	
•Different	
organization
jashmead@nistica.com 21
Some Assembly Required
•Parts	in	assembly	
travel	together		
•But	when	you	
pull	part	out?	
•And	move	it	
back?	
•Some	thought	
required!
jashmead@nistica.com 22
Start	in	Vietnam
Go	to	NJ
Replace	Sub-assembly
Ship	Back	to		
Vietnam
Pirate Checklist
23
•Tables/
relationships	
•Model/View/
Controller	
•Trust	—	but	
verify	
•Think	globally	—
act	locally	
•Guidelines	—	not	
rules
What next?
• Blogs	
• User	groups	
• Email	list	
• Books	
• Reference	
manuals
jashmead@nistica.com 24
Thank	You!
www.nistica.com
jashmead@nistica.com
25

More Related Content

What's hot

What's hot (10)

Apache spark - Installation
Apache spark - InstallationApache spark - Installation
Apache spark - Installation
 
Making Sense of Spark Performance-(Kay Ousterhout, UC Berkeley)
Making Sense of Spark Performance-(Kay Ousterhout, UC Berkeley)Making Sense of Spark Performance-(Kay Ousterhout, UC Berkeley)
Making Sense of Spark Performance-(Kay Ousterhout, UC Berkeley)
 
Discretized Stream - Fault-Tolerant Streaming Computation at Scale - SOSP
Discretized Stream - Fault-Tolerant Streaming Computation at Scale - SOSPDiscretized Stream - Fault-Tolerant Streaming Computation at Scale - SOSP
Discretized Stream - Fault-Tolerant Streaming Computation at Scale - SOSP
 
Valerii Vasylkov Erlang. measurements and benefits.
Valerii Vasylkov Erlang. measurements and benefits.Valerii Vasylkov Erlang. measurements and benefits.
Valerii Vasylkov Erlang. measurements and benefits.
 
Cluster schedulerの紹介
Cluster schedulerの紹介Cluster schedulerの紹介
Cluster schedulerの紹介
 
Distributed Stream Processing - Spark Summit East 2017
Distributed Stream Processing - Spark Summit East 2017Distributed Stream Processing - Spark Summit East 2017
Distributed Stream Processing - Spark Summit East 2017
 
A Spark Framework For < $100, < 1 Hour, Accurate Personalized DNA Analy...
A Spark Framework For < $100, < 1 Hour, Accurate Personalized DNA Analy...A Spark Framework For < $100, < 1 Hour, Accurate Personalized DNA Analy...
A Spark Framework For < $100, < 1 Hour, Accurate Personalized DNA Analy...
 
ACM DEBS Grand Challenge: Continuous Analytics on Geospatial Data Streams wit...
ACM DEBS Grand Challenge: Continuous Analytics on Geospatial Data Streams wit...ACM DEBS Grand Challenge: Continuous Analytics on Geospatial Data Streams wit...
ACM DEBS Grand Challenge: Continuous Analytics on Geospatial Data Streams wit...
 
Memcached Presentation
Memcached PresentationMemcached Presentation
Memcached Presentation
 
Postgres Performance for Humans
Postgres Performance for HumansPostgres Performance for Humans
Postgres Performance for Humans
 

Similar to From Startup to Mature Company: PostgreSQL Tips and techniques

Cassandra Tools and Distributed Administration (Jeffrey Berger, Knewton) | C*...
Cassandra Tools and Distributed Administration (Jeffrey Berger, Knewton) | C*...Cassandra Tools and Distributed Administration (Jeffrey Berger, Knewton) | C*...
Cassandra Tools and Distributed Administration (Jeffrey Berger, Knewton) | C*...
DataStax
 
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
Paresh Patel
 
Advanced Postgres Monitoring
Advanced Postgres MonitoringAdvanced Postgres Monitoring
Advanced Postgres Monitoring
Denish Patel
 
The CMS Online Cluster: 
 Setup, Operation and Maintenance 
 of an Evolving C...
The CMS Online Cluster: 
 Setup, Operation and Maintenance 
 of an Evolving C...The CMS Online Cluster: 
 Setup, Operation and Maintenance 
 of an Evolving C...
The CMS Online Cluster: 
 Setup, Operation and Maintenance 
 of an Evolving C...
Jose Antonio Coarasa Perez
 

Similar to From Startup to Mature Company: PostgreSQL Tips and techniques (20)

Cassandra Tools and Distributed Administration (Jeffrey Berger, Knewton) | C*...
Cassandra Tools and Distributed Administration (Jeffrey Berger, Knewton) | C*...Cassandra Tools and Distributed Administration (Jeffrey Berger, Knewton) | C*...
Cassandra Tools and Distributed Administration (Jeffrey Berger, Knewton) | C*...
 
Top 10 Best Practices for Apache Cassandra and DataStax Enterprise
Top 10 Best Practices for Apache Cassandra and DataStax EnterpriseTop 10 Best Practices for Apache Cassandra and DataStax Enterprise
Top 10 Best Practices for Apache Cassandra and DataStax Enterprise
 
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
 
Data Stores @ Netflix
Data Stores @ NetflixData Stores @ Netflix
Data Stores @ Netflix
 
MEETUP - Unboxing Apache Cassandra 3.10
MEETUP - Unboxing Apache Cassandra 3.10MEETUP - Unboxing Apache Cassandra 3.10
MEETUP - Unboxing Apache Cassandra 3.10
 
GE IOT Predix Time Series & Data Ingestion Service using Apache Apex (Hadoop)
GE IOT Predix Time Series & Data Ingestion Service using Apache Apex (Hadoop)GE IOT Predix Time Series & Data Ingestion Service using Apache Apex (Hadoop)
GE IOT Predix Time Series & Data Ingestion Service using Apache Apex (Hadoop)
 
Netflix at-disney-09-26-2014
Netflix at-disney-09-26-2014Netflix at-disney-09-26-2014
Netflix at-disney-09-26-2014
 
Monitoring Cassandra at Scale (Jason Cacciatore, Netflix) | C* Summit 2016
Monitoring Cassandra at Scale (Jason Cacciatore, Netflix) | C* Summit 2016Monitoring Cassandra at Scale (Jason Cacciatore, Netflix) | C* Summit 2016
Monitoring Cassandra at Scale (Jason Cacciatore, Netflix) | C* Summit 2016
 
GPS Insight on Using Presto with Scylla for Data Analytics and Data Archival
GPS Insight on Using Presto with Scylla for Data Analytics and Data ArchivalGPS Insight on Using Presto with Scylla for Data Analytics and Data Archival
GPS Insight on Using Presto with Scylla for Data Analytics and Data Archival
 
Cassandra's Odyssey @ Netflix
Cassandra's Odyssey @ NetflixCassandra's Odyssey @ Netflix
Cassandra's Odyssey @ Netflix
 
SamzaSQL QCon'16 presentation
SamzaSQL QCon'16 presentationSamzaSQL QCon'16 presentation
SamzaSQL QCon'16 presentation
 
Spark Streaming Early Warning Use Case
Spark Streaming Early Warning Use CaseSpark Streaming Early Warning Use Case
Spark Streaming Early Warning Use Case
 
Workflowsim escience12
Workflowsim escience12Workflowsim escience12
Workflowsim escience12
 
Cassandra Summit 2014: Monitor Everything!
Cassandra Summit 2014: Monitor Everything!Cassandra Summit 2014: Monitor Everything!
Cassandra Summit 2014: Monitor Everything!
 
Oracle Database In-Memory Option in Action
Oracle Database In-Memory Option in ActionOracle Database In-Memory Option in Action
Oracle Database In-Memory Option in Action
 
In Memory Database In Action by Tanel Poder and Kerry Osborne
In Memory Database In Action by Tanel Poder and Kerry OsborneIn Memory Database In Action by Tanel Poder and Kerry Osborne
In Memory Database In Action by Tanel Poder and Kerry Osborne
 
Advanced Postgres Monitoring
Advanced Postgres MonitoringAdvanced Postgres Monitoring
Advanced Postgres Monitoring
 
The CMS Online Cluster: 
 Setup, Operation and Maintenance 
 of an Evolving C...
The CMS Online Cluster: 
 Setup, Operation and Maintenance 
 of an Evolving C...The CMS Online Cluster: 
 Setup, Operation and Maintenance 
 of an Evolving C...
The CMS Online Cluster: 
 Setup, Operation and Maintenance 
 of an Evolving C...
 
Devops kc
Devops kcDevops kc
Devops kc
 
Concurrency
ConcurrencyConcurrency
Concurrency
 

More from John Ashmead

More from John Ashmead (20)

The Quantum Internet: Hype or the Next Step
The Quantum Internet:  Hype or the Next StepThe Quantum Internet:  Hype or the Next Step
The Quantum Internet: Hype or the Next Step
 
How to build a PostgreSQL-backed website quickly
How to build a PostgreSQL-backed website quicklyHow to build a PostgreSQL-backed website quickly
How to build a PostgreSQL-backed website quickly
 
The Quantum Internet: Hype or the Next Step
The Quantum Internet:  Hype or the Next StepThe Quantum Internet:  Hype or the Next Step
The Quantum Internet: Hype or the Next Step
 
Artificial Intelligence: Past, Present, Futures
Artificial Intelligence:  Past, Present, FuturesArtificial Intelligence:  Past, Present, Futures
Artificial Intelligence: Past, Present, Futures
 
Time dispersion in time-of-arrival measurements
Time dispersion in time-of-arrival measurementsTime dispersion in time-of-arrival measurements
Time dispersion in time-of-arrival measurements
 
Time dispersion in quantum mechanics -- Philcon 2019 version
Time dispersion in quantum mechanics -- Philcon 2019 versionTime dispersion in quantum mechanics -- Philcon 2019 version
Time dispersion in quantum mechanics -- Philcon 2019 version
 
Time dispersion in quantum mechanics
Time dispersion in quantum mechanicsTime dispersion in quantum mechanics
Time dispersion in quantum mechanics
 
Mars Or Bust!
Mars Or Bust!Mars Or Bust!
Mars Or Bust!
 
Practical Telepathy: The Science & Engineering of Mind-Reading
Practical Telepathy:  The Science & Engineering of Mind-ReadingPractical Telepathy:  The Science & Engineering of Mind-Reading
Practical Telepathy: The Science & Engineering of Mind-Reading
 
Practical Telepathy: The Science & Engineering of Mind-Reading
Practical Telepathy:  The Science & Engineering of Mind-ReadingPractical Telepathy:  The Science & Engineering of Mind-Reading
Practical Telepathy: The Science & Engineering of Mind-Reading
 
Stargates: Theory and Practice
Stargates:  Theory and PracticeStargates:  Theory and Practice
Stargates: Theory and Practice
 
StarGates: Theory and Practice
StarGates:  Theory and PracticeStarGates:  Theory and Practice
StarGates: Theory and Practice
 
Quantum dots
Quantum dotsQuantum dots
Quantum dots
 
Star Gates: the Theory and Practice
Star Gates:  the Theory and PracticeStar Gates:  the Theory and Practice
Star Gates: the Theory and Practice
 
Time to the power of Tim
Time to the power of TimTime to the power of Tim
Time to the power of Tim
 
How many universes are there, anyway
How many universes are there, anywayHow many universes are there, anyway
How many universes are there, anyway
 
A Quantum of Mystery
A Quantum of MysteryA Quantum of Mystery
A Quantum of Mystery
 
Converting from MySQL to PostgreSQL
Converting from MySQL to PostgreSQLConverting from MySQL to PostgreSQL
Converting from MySQL to PostgreSQL
 
Seven War Stories and a Moral
Seven War Stories and a MoralSeven War Stories and a Moral
Seven War Stories and a Moral
 
MAMP Stack - Macintosh, Apache, MySQL, PHP
MAMP Stack - Macintosh, Apache, MySQL, PHPMAMP Stack - Macintosh, Apache, MySQL, PHP
MAMP Stack - Macintosh, Apache, MySQL, PHP
 

Recently uploaded

Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native Applications
WSO2
 
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Victor Rentea
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Safe Software
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
panagenda
 

Recently uploaded (20)

Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of Terraform
 
Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native Applications
 
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
 
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
 
Exploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with MilvusExploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with Milvus
 
Corporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptxCorporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptx
 
Vector Search -An Introduction in Oracle Database 23ai.pptx
Vector Search -An Introduction in Oracle Database 23ai.pptxVector Search -An Introduction in Oracle Database 23ai.pptx
Vector Search -An Introduction in Oracle Database 23ai.pptx
 
ICT role in 21st century education and its challenges
ICT role in 21st century education and its challengesICT role in 21st century education and its challenges
ICT role in 21st century education and its challenges
 
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
 
Artificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyArtificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : Uncertainty
 
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century education
 
[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdf[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdf
 
MS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectorsMS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectors
 
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
 
CNIC Information System with Pakdata Cf In Pakistan
CNIC Information System with Pakdata Cf In PakistanCNIC Information System with Pakdata Cf In Pakistan
CNIC Information System with Pakdata Cf In Pakistan
 

From Startup to Mature Company: PostgreSQL Tips and techniques