SlideShare ist ein Scribd-Unternehmen logo
1 von 27
Downloaden Sie, um offline zu lesen
© 2ndQuadrant 2014-8
IoT with PostgreSQL
Boriss MejĂ­as
Consultant - 2ndQuadrant
Air Guitar Player
Internet of Things
with PostgreSQL
Performance & Security
© 2ndQuadrant 2014-8
IoT with PostgreSQL
Boriss MejĂ­as
Consultant - 2ndQuadrant
Air Guitar Player
Internet of Things
with PostgreSQL
Performance & Security
@postgreswomen
© 2ndQuadrant 2014-8
IoT with PostgreSQL
Internet (of people)
Internet of Things
© 2ndQuadrant 2014-8
IoT with PostgreSQL
Internet of Things
â—Ź Many Data Collectors
â—Ź Widely distributed
â—Ź Via public networks
â—Ź Multiple measures
â—Ź Massive volumes
â—Ź Low value data
â—Ź Insert-mostly workload
© 2ndQuadrant 2014-8
IoT with PostgreSQL
Internet of Things
â—Ź Many Data Collectors
â—Ź Widely distributed
â—Ź Via public networks SSL mode on
â—Ź Multiple measures
â—Ź Massive volumes
â—Ź Low value data
● Insert-mostly workload “append-only”
© 2ndQuadrant 2014-8
IoT with PostgreSQL
Which day is it?
â—Ź Recent and active data for immediate analysis
and immediate actions
â—Ź Older data for analytics to detect trends and
patterns
© 2ndQuadrant 2014-8
IoT with PostgreSQL
Why PostgreSQL
â—Ź SQL with post-relational features
© 2ndQuadrant 2014-8
IoT with PostgreSQL
Why PostgreSQL
â—Ź SQL with post-relational features
â—Ź DBEngines Database of the Year 2017
â—Ź Stack Overflow #1 Best Loved RDBMS 2018
â—Ź Cloud Adoption (AWS, Google, Microsoft, IBM)
â—Ź Other databases following PostgreSQL features
â—Ź Many forks, but open source version is strong
© 2ndQuadrant 2014-8
IoT with PostgreSQL
Logical Database Design
CREATE TABLE iot
(device_id TEXT NOT NULL
,logtime TIMESTAMP WITHOUT TIME ZONE
,datum JSONB);
© 2ndQuadrant 2014-8
IoT with PostgreSQL
Logical Database Design
CREATE TABLE iot
(device_id TEXT NOT NULL
,logtime TIMESTAMP WITHOUT TIME ZONE
,datum JSONB);
© 2ndQuadrant 2014-8
IoT with PostgreSQL
Logical Database Design
CREATE TABLE iot
(device_id TEXT NOT NULL
,logtime TIMESTAMP WITHOUT TIME ZONE
,datum JSONB);
â—Ź Encrypted communication
â—Ź Authenticate each device
© 2ndQuadrant 2014-8
IoT with PostgreSQL
JSON Features
â—Ź JSON
â—Ź JSONB
â—Ź Search functions
â—Ź Manipulation functions
© 2ndQuadrant 2014-8
IoT with PostgreSQL
JSON Features
â—Ź JSON
â—Ź JSONB
â—Ź Search functions
â—Ź Manipulation functions
â—Ź Partition by JSON expression
â—Ź Index on JSON field
â—Ź HOT updates on JSON fields
© 2ndQuadrant 2014-8
IoT with PostgreSQL
Declarative Partitioning
CREATE TABLE iot
(device_id TEXT NOT NULL
,logtime TIMESTAMP WITHOUT TIME ZONE
,datum JSONB)
PARTITION BY RANGE (logtime);
© 2ndQuadrant 2014-8
IoT with PostgreSQL
Partition over Time
© 2ndQuadrant 2014-8
IoT with PostgreSQL
Partition over Device
CREATE TABLE iot
(device_id TEXT NOT NULL
,logtime TIMESTAMP WITHOUT TIME ZONE
,datum JSONB)
PARTITION BY LIST (device_id);
© 2ndQuadrant 2014-8
IoT with PostgreSQL
Partition over Device and Time
CREATE TABLE iot
(device_id TEXT NOT NULL
,logtime TIMESTAMP WITHOUT TIME ZONE
,datum JSONB)
PARTITION BY LIST (device_id);
CREATE TABLE device_a
PARTITION OF iot FOR VALUES IN ('a')
PARTITION BY RANGE (logtime);
© 2ndQuadrant 2014-8
IoT with PostgreSQL
Declarative Partitioning
© 2ndQuadrant 2014-8
IoT with PostgreSQL
Workload - extending partitions
â—Ź ATTACH PARTITION
â—Ź DETACH PARTITION
© 2ndQuadrant 2014-8
IoT with PostgreSQL
Workload - extending partitions
â—Ź ATTACH PARTITION
â—Ź DETACH PARTITION
â—Ź Local protection laws:
– Easier to delete → Compliance
– Detached data → Retention Policy
© 2ndQuadrant 2014-8
IoT with PostgreSQL
Partitioning Solutions
â—Ź Use fewer partitions, each with BRIN indexes
â—Ź Add partitions in groups
© 2ndQuadrant 2014-8
IoT with PostgreSQL
Aggregate Data
â—Ź From ARM nodes
â—Ź To VLDB
â—Ź Using logical
replication
(pglogical)
© 2ndQuadrant 2014-8
IoT with PostgreSQL
Aggregate Data
â—Ź From ARM nodes
â—Ź To VLDB
â—Ź Using logical
replication
(pglogical)
â—Ź Do NOT use trust
on pg_hba
© 2ndQuadrant 2014-8
IoT with PostgreSQL
Bi-Directional Replication (BDR)
© 2ndQuadrant 2014-8
IoT with PostgreSQL
Conclusions
â—Ź IoT produces a lot of data
â—Ź Scale insert with partitions and BRIN
â—Ź Use JSON
â—Ź Scale with many nodes and pglogical
â—Ź PostgreSQL is really cool for IoT
© 2ndQuadrant 2014-8
IoT with PostgreSQL
© 2ndQuadrant 2014-8
IoT with PostgreSQL
â—Ź Sustainable Open Source Development
â—Ź 24/7 Bug Fix Support
â—Ź On-premise, Cloud, Hybrid with RemoteDBA
â—Ź Consulting & Training

Weitere ähnliche Inhalte

KĂĽrzlich hochgeladen

CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Servicegiselly40
 
Developing An App To Navigate The Roads of Brazil
Developing An App To Navigate The Roads of BrazilDeveloping An App To Navigate The Roads of Brazil
Developing An App To Navigate The Roads of BrazilV3cube
 
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...gurkirankumar98700
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountPuma Security, LLC
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024The Digital Insurer
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking MenDelhi Call girls
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Drew Madelung
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking MenDelhi Call girls
 
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 2024Rafal Los
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking MenDelhi Call girls
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking MenDelhi Call girls
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationMichael W. Hawkins
 
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfEnterprise Knowledge
 
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 AutomationSafe Software
 
Top 5 Benefits OF Using Muvi Live Paywall For Live Streams
Top 5 Benefits OF Using Muvi Live Paywall For Live StreamsTop 5 Benefits OF Using Muvi Live Paywall For Live Streams
Top 5 Benefits OF Using Muvi Live Paywall For Live StreamsRoshan Dwivedi
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptxHampshireHUG
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsEnterprise Knowledge
 
Unblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesUnblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesSinan KOZAK
 
A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024Results
 
Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Enterprise Knowledge
 

KĂĽrzlich hochgeladen (20)

CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Service
 
Developing An App To Navigate The Roads of Brazil
Developing An App To Navigate The Roads of BrazilDeveloping An App To Navigate The Roads of Brazil
Developing An App To Navigate The Roads of Brazil
 
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path Mount
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
 
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
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day Presentation
 
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
 
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
 
Top 5 Benefits OF Using Muvi Live Paywall For Live Streams
Top 5 Benefits OF Using Muvi Live Paywall For Live StreamsTop 5 Benefits OF Using Muvi Live Paywall For Live Streams
Top 5 Benefits OF Using Muvi Live Paywall For Live Streams
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI Solutions
 
Unblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesUnblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen Frames
 
A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024
 
Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...
 

Empfohlen

How Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental HealthHow Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental HealthThinkNow
 
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdfAI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdfmarketingartwork
 
PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024Neil Kimberley
 
Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)contently
 
How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024Albert Qian
 
Social Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsSocial Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsKurio // The Social Media Age(ncy)
 
Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024Search Engine Journal
 
5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summarySpeakerHub
 
ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd Clark Boyd
 
Getting into the tech field. what next
Getting into the tech field. what next Getting into the tech field. what next
Getting into the tech field. what next Tessa Mero
 
Google's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search IntentGoogle's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search IntentLily Ray
 
Introduction to Data Science
Introduction to Data ScienceIntroduction to Data Science
Introduction to Data ScienceChristy Abraham Joy
 
Time Management & Productivity - Best Practices
Time Management & Productivity -  Best PracticesTime Management & Productivity -  Best Practices
Time Management & Productivity - Best PracticesVit Horky
 
The six step guide to practical project management
The six step guide to practical project managementThe six step guide to practical project management
The six step guide to practical project managementMindGenius
 
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...RachelPearson36
 
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...Applitools
 
12 Ways to Increase Your Influence at Work
12 Ways to Increase Your Influence at Work12 Ways to Increase Your Influence at Work
12 Ways to Increase Your Influence at WorkGetSmarter
 
ChatGPT webinar slides
ChatGPT webinar slidesChatGPT webinar slides
ChatGPT webinar slidesAlireza Esmikhani
 

Empfohlen (20)

How Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental HealthHow Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental Health
 
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdfAI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
 
Skeleton Culture Code
Skeleton Culture CodeSkeleton Culture Code
Skeleton Culture Code
 
PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024
 
Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)
 
How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024
 
Social Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsSocial Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie Insights
 
Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024
 
5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary
 
ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd
 
Getting into the tech field. what next
Getting into the tech field. what next Getting into the tech field. what next
Getting into the tech field. what next
 
Google's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search IntentGoogle's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search Intent
 
How to have difficult conversations
How to have difficult conversations How to have difficult conversations
How to have difficult conversations
 
Introduction to Data Science
Introduction to Data ScienceIntroduction to Data Science
Introduction to Data Science
 
Time Management & Productivity - Best Practices
Time Management & Productivity -  Best PracticesTime Management & Productivity -  Best Practices
Time Management & Productivity - Best Practices
 
The six step guide to practical project management
The six step guide to practical project managementThe six step guide to practical project management
The six step guide to practical project management
 
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
 
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
 
12 Ways to Increase Your Influence at Work
12 Ways to Increase Your Influence at Work12 Ways to Increase Your Influence at Work
12 Ways to Increase Your Influence at Work
 
ChatGPT webinar slides
ChatGPT webinar slidesChatGPT webinar slides
ChatGPT webinar slides
 

PGDay.Amsterdam 2018 - Boriss Mejias - Internet of Things with PostgreSQL

  • 1. © 2ndQuadrant 2014-8 IoT with PostgreSQL Boriss MejĂ­as Consultant - 2ndQuadrant Air Guitar Player Internet of Things with PostgreSQL Performance & Security
  • 2. © 2ndQuadrant 2014-8 IoT with PostgreSQL Boriss MejĂ­as Consultant - 2ndQuadrant Air Guitar Player Internet of Things with PostgreSQL Performance & Security @postgreswomen
  • 3. © 2ndQuadrant 2014-8 IoT with PostgreSQL Internet (of people) Internet of Things
  • 4. © 2ndQuadrant 2014-8 IoT with PostgreSQL Internet of Things â—Ź Many Data Collectors â—Ź Widely distributed â—Ź Via public networks â—Ź Multiple measures â—Ź Massive volumes â—Ź Low value data â—Ź Insert-mostly workload
  • 5. © 2ndQuadrant 2014-8 IoT with PostgreSQL Internet of Things â—Ź Many Data Collectors â—Ź Widely distributed â—Ź Via public networks SSL mode on â—Ź Multiple measures â—Ź Massive volumes â—Ź Low value data â—Ź Insert-mostly workload “append-only”
  • 6. © 2ndQuadrant 2014-8 IoT with PostgreSQL Which day is it? â—Ź Recent and active data for immediate analysis and immediate actions â—Ź Older data for analytics to detect trends and patterns
  • 7. © 2ndQuadrant 2014-8 IoT with PostgreSQL Why PostgreSQL â—Ź SQL with post-relational features
  • 8. © 2ndQuadrant 2014-8 IoT with PostgreSQL Why PostgreSQL â—Ź SQL with post-relational features â—Ź DBEngines Database of the Year 2017 â—Ź Stack Overflow #1 Best Loved RDBMS 2018 â—Ź Cloud Adoption (AWS, Google, Microsoft, IBM) â—Ź Other databases following PostgreSQL features â—Ź Many forks, but open source version is strong
  • 9. © 2ndQuadrant 2014-8 IoT with PostgreSQL Logical Database Design CREATE TABLE iot (device_id TEXT NOT NULL ,logtime TIMESTAMP WITHOUT TIME ZONE ,datum JSONB);
  • 10. © 2ndQuadrant 2014-8 IoT with PostgreSQL Logical Database Design CREATE TABLE iot (device_id TEXT NOT NULL ,logtime TIMESTAMP WITHOUT TIME ZONE ,datum JSONB);
  • 11. © 2ndQuadrant 2014-8 IoT with PostgreSQL Logical Database Design CREATE TABLE iot (device_id TEXT NOT NULL ,logtime TIMESTAMP WITHOUT TIME ZONE ,datum JSONB); â—Ź Encrypted communication â—Ź Authenticate each device
  • 12. © 2ndQuadrant 2014-8 IoT with PostgreSQL JSON Features â—Ź JSON â—Ź JSONB â—Ź Search functions â—Ź Manipulation functions
  • 13. © 2ndQuadrant 2014-8 IoT with PostgreSQL JSON Features â—Ź JSON â—Ź JSONB â—Ź Search functions â—Ź Manipulation functions â—Ź Partition by JSON expression â—Ź Index on JSON field â—Ź HOT updates on JSON fields
  • 14. © 2ndQuadrant 2014-8 IoT with PostgreSQL Declarative Partitioning CREATE TABLE iot (device_id TEXT NOT NULL ,logtime TIMESTAMP WITHOUT TIME ZONE ,datum JSONB) PARTITION BY RANGE (logtime);
  • 15. © 2ndQuadrant 2014-8 IoT with PostgreSQL Partition over Time
  • 16. © 2ndQuadrant 2014-8 IoT with PostgreSQL Partition over Device CREATE TABLE iot (device_id TEXT NOT NULL ,logtime TIMESTAMP WITHOUT TIME ZONE ,datum JSONB) PARTITION BY LIST (device_id);
  • 17. © 2ndQuadrant 2014-8 IoT with PostgreSQL Partition over Device and Time CREATE TABLE iot (device_id TEXT NOT NULL ,logtime TIMESTAMP WITHOUT TIME ZONE ,datum JSONB) PARTITION BY LIST (device_id); CREATE TABLE device_a PARTITION OF iot FOR VALUES IN ('a') PARTITION BY RANGE (logtime);
  • 18. © 2ndQuadrant 2014-8 IoT with PostgreSQL Declarative Partitioning
  • 19. © 2ndQuadrant 2014-8 IoT with PostgreSQL Workload - extending partitions â—Ź ATTACH PARTITION â—Ź DETACH PARTITION
  • 20. © 2ndQuadrant 2014-8 IoT with PostgreSQL Workload - extending partitions â—Ź ATTACH PARTITION â—Ź DETACH PARTITION â—Ź Local protection laws: – Easier to delete → Compliance – Detached data → Retention Policy
  • 21. © 2ndQuadrant 2014-8 IoT with PostgreSQL Partitioning Solutions â—Ź Use fewer partitions, each with BRIN indexes â—Ź Add partitions in groups
  • 22. © 2ndQuadrant 2014-8 IoT with PostgreSQL Aggregate Data â—Ź From ARM nodes â—Ź To VLDB â—Ź Using logical replication (pglogical)
  • 23. © 2ndQuadrant 2014-8 IoT with PostgreSQL Aggregate Data â—Ź From ARM nodes â—Ź To VLDB â—Ź Using logical replication (pglogical) â—Ź Do NOT use trust on pg_hba
  • 24. © 2ndQuadrant 2014-8 IoT with PostgreSQL Bi-Directional Replication (BDR)
  • 25. © 2ndQuadrant 2014-8 IoT with PostgreSQL Conclusions â—Ź IoT produces a lot of data â—Ź Scale insert with partitions and BRIN â—Ź Use JSON â—Ź Scale with many nodes and pglogical â—Ź PostgreSQL is really cool for IoT
  • 26. © 2ndQuadrant 2014-8 IoT with PostgreSQL
  • 27. © 2ndQuadrant 2014-8 IoT with PostgreSQL â—Ź Sustainable Open Source Development â—Ź 24/7 Bug Fix Support â—Ź On-premise, Cloud, Hybrid with RemoteDBA â—Ź Consulting & Training