SlideShare a Scribd company logo
1 of 22
Download to read offline
Migrating to Postgresql
For Charlotte SQL Saturday on 12/07/2019
By Ramu Pulipati
Thank You to our Sponsors
About Me
Cofounder / CTO at Botsplash
Software-as-a-service and hosted
messaging platform to engage
businesses and customers. botsplash.com
What is Postgresql?
• Free & Open Source RDMS
• Alternative to Microsoft SQL Server, MySQL, Oracle, Mongo
DB or any RDBMS and NoSQL databases
• Battle tested for over 30 years with continuous
improvements to support modern applications
DERIVED
Who uses
PostgreSQL?
EXTENSIONS
Why Postgresql?
• BSD License
• Free for Commercial use
• No vendor Lock-in
• Predictable releases & fixes
• Active Community
• Great Performance
• Extensibility
• Hosted options
• Professional Services
Source: postgresql.org
Differentiators
• Strong SQL Types
• Rich JSON Support / NoSQL
• Native Table Partitioning
• Full Text Search
• Pubsub
• GIS / Spatial Functionality
• Scalability & Multi-tenancy
• Extensibility
80%
Commercial
Databases
Postgresql
Trends
Source: Stackoverflow from
Igal Sapir slides
Compare with others
• Replaces
• Mongo Db
• SQL Server
• MySQL
• Oracle
• Complements
• Redis
• Elasticsearch
• Clickhouse
Source: NoSQL Performance Benchmark 02/27/2018
History & What’s new Version Major Feature
V12
10/03/2019
JSONB Query & Partition
Improvements, Performance
V11
10/18/2018
Query Parallelism Improvements
Just-in-time compilation
V10
10/05/2017
Declarative Table Partitions
Logical Replication
Improved Monitoring and Control
V9.6
09/29/2016
Parallel Query
Foreign Data Wrappers
Replication
V9.5
07/01/2016
JSONB Modifying Operators
Row level security
UPSERT statement
V9.4
12/18/2014
Introduce JSONB
Materialized View Improvements
Source: Postgresql Releases
Getting Started
• Download and Install
• Postgres 11+ supports Windows
2012 R2 deployment.
• Cloud hosting options
• Client
• pgAdmin
• psql command line
SQL Support
• Case Sensitive Schema Names
• Case Sensitive Data Storage
• Type casting & Operators
• Date Time formatting
• Common Table Expressions
• Array Data Types
• Upserts
• Stored Procedures
• Multiple languages support
Common Data Types
Data Type Commonly Used Names
Number Smallint, integer, Bigint, decimal, Money
Number (auto) Serial, BigSerial
Enum Enum data types stored
Character Char, nchar, Text
Binary Bytea
Date Time Timestamp with timezone, Timestamp without Timezone, interval
Collections Array, JSON, JSONB
Misc Boolean, UUID, Geo Types, Network Address Mac Address, Custom Types
Full Text Search TsVector, TsQuery
See details from tutorials point
Special Data Types
• Collections
• Arrays
• Range Types
• Searchable
• Indexable
• Aggregate functions
Credit: Igal Sapir slides
JSON Datatypes
• Equivalent to embedded MongoDB
Credit: postgresql documentation
Notable Functions Description
::JSONB Casting
|| or JSONB_SET or
JSONB_BUILD_OBJECT
Build or set JSONB values
JSONB_AGG &
JSONB_BUILD_ARRAY
Aggregate functions
JSONB_PATH_*,
JSONB_EACH,
JSONB_EXTRACT
Path & Extract Functions
JSONB DEMO
Advanced Data Types
• Pivot Tables crosstab function
• Materialized Views
• HStore
• EXPLAIN ANALYZE
• Pg_stat
• XML Columns (not much used)
Concurrency - MVCC
• Postgres uses “Multi-version concurrency control”.
• Isolation at “read-committed” level
• Row level locks are explicit
• Same technique used in Oracle, CouchDB, etc
Indexes
• Index Support
• Single Column / Exact Matches
• Multi Column
• Unique
• Partial Indexes
• Expression Indexes
• Implicit Indexes (PK, UK)
Credit: Igal Sapir slides
Disadvantages / Limits
• Database only solution
• Few available tools
compared to commercial
• Limited Talent Pool
Source: https://www.youtube.com/watch?v=6p2TNPabt6M
Source: Postgres limits from sreenstepslive.com
Best Practices
• Performance Optimization
• Do not read from Database at all
• Use indexes efficiently
• Use pg_stats collector to monitor usage and performance
• Vacuum regularly to clean up storage
• Bench mark hardware and optimize pg parameters
• Always use SSL for connectivity in untrusted networks
Reasons to Fill Out Session Evaluations
Helps Speakers
Helps Organizers
Helps You!
References and Follow up
• Postgresql Documentatoin
• Igal Sapir Postgresql Presentation
• Introduction to Postgresql slideshare
• The Internals of Postgresql
• Postgresql excercises
• MVCC: postgres internals or interdb
Questions? Contact me at ramu@botsplash.com

More Related Content

What's hot

Postgres_9.0 vs MySQL_5.5
Postgres_9.0 vs MySQL_5.5Postgres_9.0 vs MySQL_5.5
Postgres_9.0 vs MySQL_5.5
Trieu Dao Minh
 
Drill architecture 20120913
Drill architecture 20120913Drill architecture 20120913
Drill architecture 20120913
jasonfrantz
 

What's hot (20)

Bn 1016 demo postgre sql-online-training
Bn 1016 demo  postgre sql-online-trainingBn 1016 demo  postgre sql-online-training
Bn 1016 demo postgre sql-online-training
 
PGDay.Seoul 2016 lightingtalk
PGDay.Seoul 2016 lightingtalkPGDay.Seoul 2016 lightingtalk
PGDay.Seoul 2016 lightingtalk
 
Microsoft Hekaton
Microsoft HekatonMicrosoft Hekaton
Microsoft Hekaton
 
Presto updates to 0.178
Presto updates to 0.178Presto updates to 0.178
Presto updates to 0.178
 
NoSQL databases
NoSQL databasesNoSQL databases
NoSQL databases
 
Postgres_9.0 vs MySQL_5.5
Postgres_9.0 vs MySQL_5.5Postgres_9.0 vs MySQL_5.5
Postgres_9.0 vs MySQL_5.5
 
How to ensure Presto scalability 
in multi use case
How to ensure Presto scalability 
in multi use case How to ensure Presto scalability 
in multi use case
How to ensure Presto scalability 
in multi use case
 
Presto
PrestoPresto
Presto
 
In memory databases presentation
In memory databases presentationIn memory databases presentation
In memory databases presentation
 
No SQL and MongoDB - Hyderabad Scalability Meetup
No SQL and MongoDB - Hyderabad Scalability MeetupNo SQL and MongoDB - Hyderabad Scalability Meetup
No SQL and MongoDB - Hyderabad Scalability Meetup
 
Presto At Treasure Data
Presto At Treasure DataPresto At Treasure Data
Presto At Treasure Data
 
Introduction to Postrges-XC
Introduction to Postrges-XCIntroduction to Postrges-XC
Introduction to Postrges-XC
 
Introduction to Presto at Treasure Data
Introduction to Presto at Treasure DataIntroduction to Presto at Treasure Data
Introduction to Presto at Treasure Data
 
In-memory Databases
In-memory DatabasesIn-memory Databases
In-memory Databases
 
What database
What databaseWhat database
What database
 
Drill architecture 20120913
Drill architecture 20120913Drill architecture 20120913
Drill architecture 20120913
 
The Great Debate: PostgreSQL vs MySQL
The Great Debate: PostgreSQL vs MySQLThe Great Debate: PostgreSQL vs MySQL
The Great Debate: PostgreSQL vs MySQL
 
What's New in PostgreSQL 9.6
What's New in PostgreSQL 9.6What's New in PostgreSQL 9.6
What's New in PostgreSQL 9.6
 
MongoDB 3.0 and WiredTiger (Event: An Evening with MongoDB Dallas 3/10/15)
MongoDB 3.0 and WiredTiger (Event: An Evening with MongoDB Dallas 3/10/15)MongoDB 3.0 and WiredTiger (Event: An Evening with MongoDB Dallas 3/10/15)
MongoDB 3.0 and WiredTiger (Event: An Evening with MongoDB Dallas 3/10/15)
 
NoSQL databases - An introduction
NoSQL databases - An introductionNoSQL databases - An introduction
NoSQL databases - An introduction
 

Similar to Migrating to postgresql

Similar to Migrating to postgresql (20)

mongodb_DS.pptx
mongodb_DS.pptxmongodb_DS.pptx
mongodb_DS.pptx
 
CosmosDB.pptx
CosmosDB.pptxCosmosDB.pptx
CosmosDB.pptx
 
NoSQL and Spatial Database Capabilities using PostgreSQL
NoSQL and Spatial Database Capabilities using PostgreSQLNoSQL and Spatial Database Capabilities using PostgreSQL
NoSQL and Spatial Database Capabilities using PostgreSQL
 
Untangling - fall2017 - week 8
Untangling - fall2017 - week 8Untangling - fall2017 - week 8
Untangling - fall2017 - week 8
 
MongoDB Basics
MongoDB BasicsMongoDB Basics
MongoDB Basics
 
Mongo DB
Mongo DB Mongo DB
Mongo DB
 
NoSQL for SQL Server Developers using Couchbase
NoSQL for SQL Server Developers using CouchbaseNoSQL for SQL Server Developers using Couchbase
NoSQL for SQL Server Developers using Couchbase
 
Mongo db 3.4 Overview
Mongo db 3.4 OverviewMongo db 3.4 Overview
Mongo db 3.4 Overview
 
Drupal meets PostgreSQL for DrupalCamp MSK 2014
Drupal meets PostgreSQL for DrupalCamp MSK 2014Drupal meets PostgreSQL for DrupalCamp MSK 2014
Drupal meets PostgreSQL for DrupalCamp MSK 2014
 
No sql Database
No sql DatabaseNo sql Database
No sql Database
 
Javascript on Server-Side
Javascript on Server-SideJavascript on Server-Side
Javascript on Server-Side
 
Azure - Data Platform
Azure - Data PlatformAzure - Data Platform
Azure - Data Platform
 
MongoDB
MongoDBMongoDB
MongoDB
 
CosmosDB for DBAs & Developers
CosmosDB for DBAs & DevelopersCosmosDB for DBAs & Developers
CosmosDB for DBAs & Developers
 
3 CityNetConf - sql+c#=u-sql
3 CityNetConf - sql+c#=u-sql3 CityNetConf - sql+c#=u-sql
3 CityNetConf - sql+c#=u-sql
 
Document db
Document dbDocument db
Document db
 
NoSQL on ACID - Meet Unstructured Postgres
NoSQL on ACID - Meet Unstructured PostgresNoSQL on ACID - Meet Unstructured Postgres
NoSQL on ACID - Meet Unstructured Postgres
 
Introduction to azure document db
Introduction to azure document dbIntroduction to azure document db
Introduction to azure document db
 
Azure Cosmos DB: Features, Practical Use and Optimization "
Azure Cosmos DB: Features, Practical Use and Optimization "Azure Cosmos DB: Features, Practical Use and Optimization "
Azure Cosmos DB: Features, Practical Use and Optimization "
 
U-SQL - Azure Data Lake Analytics for Developers
U-SQL - Azure Data Lake Analytics for DevelopersU-SQL - Azure Data Lake Analytics for Developers
U-SQL - Azure Data Lake Analytics for Developers
 

More from botsplash.com

More from botsplash.com (14)

Bootstrap SaaS startup using Open Source Tools
Bootstrap SaaS startup using Open Source ToolsBootstrap SaaS startup using Open Source Tools
Bootstrap SaaS startup using Open Source Tools
 
Devops Days, 2019 - Charlotte
Devops Days, 2019 - CharlotteDevops Days, 2019 - Charlotte
Devops Days, 2019 - Charlotte
 
Building NLP solutions for Davidson ML Group
Building NLP solutions for Davidson ML GroupBuilding NLP solutions for Davidson ML Group
Building NLP solutions for Davidson ML Group
 
Building NLP solutions using Python
Building NLP solutions using PythonBuilding NLP solutions using Python
Building NLP solutions using Python
 
Chat interfaces, Extension to Digital Marketing
Chat interfaces, Extension to Digital MarketingChat interfaces, Extension to Digital Marketing
Chat interfaces, Extension to Digital Marketing
 
Cloud computing options
Cloud computing optionsCloud computing options
Cloud computing options
 
Data Science meets Digital Marketing
Data Science meets Digital MarketingData Science meets Digital Marketing
Data Science meets Digital Marketing
 
botsplash deep dive
botsplash deep divebotsplash deep dive
botsplash deep dive
 
Building Twitter bot using Python
Building Twitter bot using PythonBuilding Twitter bot using Python
Building Twitter bot using Python
 
Python for data science
Python for data sciencePython for data science
Python for data science
 
Live development & tools
Live development & toolsLive development & tools
Live development & tools
 
AI Use Cases discussion
AI Use Cases discussionAI Use Cases discussion
AI Use Cases discussion
 
Career advice for beginner software engineers
Career advice for beginner software engineersCareer advice for beginner software engineers
Career advice for beginner software engineers
 
Node.js Getting Started &amd Best Practices
Node.js Getting Started &amd Best PracticesNode.js Getting Started &amd Best Practices
Node.js Getting Started &amd Best Practices
 

Recently uploaded

+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
?#DUbAI#??##{{(☎️+971_581248768%)**%*]'#abortion pills for sale in dubai@
 
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)

The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024
 
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, ...
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
 
Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024
 
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...
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a Fresher
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Script
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
 
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
 
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
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
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
 
Deploy with confidence: VMware Cloud Foundation 5.1 on next gen Dell PowerEdg...
Deploy with confidence: VMware Cloud Foundation 5.1 on next gen Dell PowerEdg...Deploy with confidence: VMware Cloud Foundation 5.1 on next gen Dell PowerEdg...
Deploy with confidence: VMware Cloud Foundation 5.1 on next gen Dell PowerEdg...
 
Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024
 

Migrating to postgresql

  • 1. Migrating to Postgresql For Charlotte SQL Saturday on 12/07/2019 By Ramu Pulipati
  • 2. Thank You to our Sponsors
  • 3. About Me Cofounder / CTO at Botsplash Software-as-a-service and hosted messaging platform to engage businesses and customers. botsplash.com
  • 4. What is Postgresql? • Free & Open Source RDMS • Alternative to Microsoft SQL Server, MySQL, Oracle, Mongo DB or any RDBMS and NoSQL databases • Battle tested for over 30 years with continuous improvements to support modern applications
  • 6. Why Postgresql? • BSD License • Free for Commercial use • No vendor Lock-in • Predictable releases & fixes • Active Community • Great Performance • Extensibility • Hosted options • Professional Services Source: postgresql.org
  • 7. Differentiators • Strong SQL Types • Rich JSON Support / NoSQL • Native Table Partitioning • Full Text Search • Pubsub • GIS / Spatial Functionality • Scalability & Multi-tenancy • Extensibility 80% Commercial Databases Postgresql
  • 9. Compare with others • Replaces • Mongo Db • SQL Server • MySQL • Oracle • Complements • Redis • Elasticsearch • Clickhouse Source: NoSQL Performance Benchmark 02/27/2018
  • 10. History & What’s new Version Major Feature V12 10/03/2019 JSONB Query & Partition Improvements, Performance V11 10/18/2018 Query Parallelism Improvements Just-in-time compilation V10 10/05/2017 Declarative Table Partitions Logical Replication Improved Monitoring and Control V9.6 09/29/2016 Parallel Query Foreign Data Wrappers Replication V9.5 07/01/2016 JSONB Modifying Operators Row level security UPSERT statement V9.4 12/18/2014 Introduce JSONB Materialized View Improvements Source: Postgresql Releases
  • 11. Getting Started • Download and Install • Postgres 11+ supports Windows 2012 R2 deployment. • Cloud hosting options • Client • pgAdmin • psql command line
  • 12. SQL Support • Case Sensitive Schema Names • Case Sensitive Data Storage • Type casting & Operators • Date Time formatting • Common Table Expressions • Array Data Types • Upserts • Stored Procedures • Multiple languages support
  • 13. Common Data Types Data Type Commonly Used Names Number Smallint, integer, Bigint, decimal, Money Number (auto) Serial, BigSerial Enum Enum data types stored Character Char, nchar, Text Binary Bytea Date Time Timestamp with timezone, Timestamp without Timezone, interval Collections Array, JSON, JSONB Misc Boolean, UUID, Geo Types, Network Address Mac Address, Custom Types Full Text Search TsVector, TsQuery See details from tutorials point
  • 14. Special Data Types • Collections • Arrays • Range Types • Searchable • Indexable • Aggregate functions Credit: Igal Sapir slides
  • 15. JSON Datatypes • Equivalent to embedded MongoDB Credit: postgresql documentation Notable Functions Description ::JSONB Casting || or JSONB_SET or JSONB_BUILD_OBJECT Build or set JSONB values JSONB_AGG & JSONB_BUILD_ARRAY Aggregate functions JSONB_PATH_*, JSONB_EACH, JSONB_EXTRACT Path & Extract Functions JSONB DEMO
  • 16. Advanced Data Types • Pivot Tables crosstab function • Materialized Views • HStore • EXPLAIN ANALYZE • Pg_stat • XML Columns (not much used)
  • 17. Concurrency - MVCC • Postgres uses “Multi-version concurrency control”. • Isolation at “read-committed” level • Row level locks are explicit • Same technique used in Oracle, CouchDB, etc
  • 18. Indexes • Index Support • Single Column / Exact Matches • Multi Column • Unique • Partial Indexes • Expression Indexes • Implicit Indexes (PK, UK) Credit: Igal Sapir slides
  • 19. Disadvantages / Limits • Database only solution • Few available tools compared to commercial • Limited Talent Pool Source: https://www.youtube.com/watch?v=6p2TNPabt6M Source: Postgres limits from sreenstepslive.com
  • 20. Best Practices • Performance Optimization • Do not read from Database at all • Use indexes efficiently • Use pg_stats collector to monitor usage and performance • Vacuum regularly to clean up storage • Bench mark hardware and optimize pg parameters • Always use SSL for connectivity in untrusted networks
  • 21. Reasons to Fill Out Session Evaluations Helps Speakers Helps Organizers Helps You!
  • 22. References and Follow up • Postgresql Documentatoin • Igal Sapir Postgresql Presentation • Introduction to Postgresql slideshare • The Internals of Postgresql • Postgresql excercises • MVCC: postgres internals or interdb Questions? Contact me at ramu@botsplash.com