SlideShare a Scribd company logo
1 of 29
Download to read offline
groonga with
 PostgreSQL
2011/11/29 groonga           #2
          &     (@choplin)



                                  1
Agenda

• Extensibility of PostgreSQL
• How to work with groonga
• textsearch_groonga
• groonga_fdw

                                2
Extensibility of
 PostgreSQL


                   3
Extensibility of PostgreSQL


                                                 dblink, adminpack, pgcrypto, ...

                       Parser
                                                 cube,  ltree,  citext,  hstore,  json,  …
    Functions        Data Types   PL
                                                 pl/R,  pl/v8js,  pl/Ruby,  pl/Lua,  …
                     Optimizer
                                                  pgadviser
                      Executor

                       Table                      auto_explain

                       Index
                                                GiST/GIN,
                                                textsearch_senna, textsearch_groonga
  SQL/MED (9.1!)

                                       c.f.  external  tools:  pgpool,  slony,  pg_bulkload…

©2011 FORCIA, Inc.


         http://www.slideshare.net/HitoshiHarada/extensions-on-postgresql

                                                                                               4
PGXN
• PostgreSQL Extension Network
• Central distribution system for
  PostgreSQL Extension
 • Inspired by CPAN for Perl library
• Provides:
 • Manager, API, Search, Client
• under development ...
                                       5
PGXN




       6
Only three steps to
 install an extension
$ pgxn install tinyint
$ psql
# CREATE EXTENSION tinyint;
                         --That’s all, yay!

            Coming soon
                                              7
How to work
with groonga


               8
Extensibility of PostgreSQL


                                                 dblink, adminpack, pgcrypto, ...

                       Parser
                                                 cube,  ltree,  citext,  hstore,  json,  …
    Functions        Data Types   PL
                                                 pl/R,  pl/v8js,  pl/Ruby,  pl/Lua,  …
                     Optimizer
                                                  pgadviser
                      Executor

                       Table                      auto_explain

                       Index
                                                GiST/GIN,
                                                textsearch_senna, textsearch_groonga
  SQL/MED (9.1!)

                                       c.f.  external  tools:  pgpool,  slony,  pg_bulkload…

©2011 FORCIA, Inc.


         http://www.slideshare.net/HitoshiHarada/extensions-on-postgresql

                                                                                               9
Extensibility of PostgreSQL


                                                 dblink, adminpack, pgcrypto, ...

                       Parser
                                                 cube,  ltree,  citext,  hstore,  json,  …
    Functions        Data Types   PL
                                                 pl/R,  pl/v8js,  pl/Ruby,  pl/Lua,  …
                     Optimizer
                                                  pgadviser
                      Executor
                                                  auto_explain
                       Table
                                                                               As Index
                       Index
                                                GiST/GIN,
                                                textsearch_senna, textsearch_groonga
  SQL/MED (9.1!)

                                       c.f.  external  tools:  pgpool,  slony,  pg_bulkload…

©2011 FORCIA, Inc.


         http://www.slideshare.net/HitoshiHarada/extensions-on-postgresql

                                                                                               9
Extensibility of PostgreSQL


                                                 dblink, adminpack, pgcrypto, ...

                       Parser
                                                 cube,  ltree,  citext,  hstore,  json,  …
    Functions        Data Types   PL
                                                 pl/R,  pl/v8js,  pl/Ruby,  pl/Lua,  …
                     Optimizer
                                                  pgadviser
                      Executor
                                                  auto_explain
                       Table
                                                                               As Index
                           As FDW
                       Index
                                                GiST/GIN,
                                                textsearch_senna, textsearch_groonga
  SQL/MED (9.1!)
 groonga_fdw                           c.f.  external  tools:  pgpool,  slony,  pg_bulkload…

©2011 FORCIA, Inc.


         http://www.slideshare.net/HitoshiHarada/extensions-on-postgresql

                                                                                               9
textsearch_groonga



                     10
Full text search
           in PostgreSQL
                          Builtin                 Extension

                      Tsearch (8.3-)
morphological
                            +
  analysis
                      textsearch_ja

                                                   Ludia
                    contrib/pg_trgm
  N-gram                                     textsearch_senna
                         (9.1-)
                                            textsearch_groonga

    https://docs.google.com/present/view?id=dhk2smpg_3h44cnrdv
                                                                 11
Motivation
textsearch_groonga
    • textsearch_ja (           )




    • textsearch_senna (N-gram)

              PostgreSQL 8.3 HOT
              Senna                                              …


    • textsearch_groonga

©2010 FORCIA, Inc.


    http://www.slideshare.net/ItagakiTakahiro/textsearch-groonga-v01
                                                                       12
Indexing
                :
    • CREATE TABLE tbl(id serial, doc text);
    • COPY tbl(doc) FROM '...'; --
    • CREATE INDEX idx ON tbl USING groonga (doc);


             CTID                 _key         CTID               _key
            (1, 0)   foo    1.5    1     bar   (1, 1)     ar       1
            (1, 1)   bar    2.0    2     baz   (2, 0)     az       2
            (2, 0)   baz    4.5    3     foo   (1,0)      ba      1, 2

 CTID =                                                   fo       3
                                                          oo       3

               PostgreSQL         groonga               groonga

©2010 FORCIA, Inc.


    http://www.slideshare.net/ItagakiTakahiro/textsearch-groonga-v01
                                                                         13
Querying
                :
    • SELECT * FROM tbl WHERE …
          –
                • doc = '                '–
                     – <, <=, =, >=, >, <>
                •
          –
                • doc %% '                    ' – N-gram
                •
          – grn_expr
                • doc @@ groonga.query('                   ', '   ')
                •


©2010 FORCIA, Inc.


    http://www.slideshare.net/ItagakiTakahiro/textsearch-groonga-v01
                                                                       14
groonga_fdw



              15
SQL/MED
•   Management of External Data
 • SQL Standard (SQL:2003)
• Consists:
 • Foreign Table
 • DATALINK
                                  16
SQL/MED
•   Management of External Data
 • SQL Standard (SQL:2003)
• Consists:
 • Foreign Table      Implemented as FDW
                           in Postgres
 • DATALINK
                                           16
FDW
• Foreign Data Wrapper
 • External data as Table of PostgreSQL
 • Available from 9.1
• Only “SELECT” statement is available
  now
• Very simple API interface
 • Only 6 callbacks are required :)
                                          17
FDW

                              Internal
Parser   Planner   Executer
                              Storage




                                         18
FDW

                              Internal
Parser   Planner   Executer
                              Storage


                              External
                               Data
                       FDW
                                         18
FDW
• Example:
 • Oracle
 • MySQL
 • Redis
 • Amazon S3
 • Twitter
 • and more... (see http://pgxn.org/tag/fdw/ )
                                                 19
groonga_fdw

• Foreign Data Wrapper for groonga
 • You can query groonga via postgres
   with usual SQL
• Under Development

                                        20
How to use
 Install   # CREATE EXTENTION groonga_fdw;

           # CREATE SERVER groonga_server
               FOREIGN DATA WRAPPER groonga_fdw
Connect        OPTIONS ( dbpath ‘ );


           # CREATE FOREIGN TABLE groonga_fdw_tutorial (
              _key text
              title text
            )
 Table      SERVER groonga_server
            OPTIONS ( ... );



                                                           21
How to use


Query # SELECT * FROM groonga_fdw_tutorial;




                                              22
Compare

• textsearch_groonga
 • <-> Tritton
• groonga_fdw
 • <-> mroonga

                       23
Summary

• PostgreSQL is quite extensible
• Two ways to work with groonga
 • textsearch_groonga
 • groonga_fdw
• PostgreSQL and groonga are good friend :)

                                              24
Thanks!



          25

More Related Content

Similar to PostgreSQL and Groonga Integration

Extensions on PostgreSQL
Extensions on PostgreSQLExtensions on PostgreSQL
Extensions on PostgreSQLAlpaca
 
Useful PostgreSQL Extensions
Useful PostgreSQL ExtensionsUseful PostgreSQL Extensions
Useful PostgreSQL ExtensionsEDB
 
Large scale crawling with Apache Nutch
Large scale crawling with Apache NutchLarge scale crawling with Apache Nutch
Large scale crawling with Apache NutchJulien Nioche
 
Python Powered Data Science at Pivotal (PyData 2013)
Python Powered Data Science at Pivotal (PyData 2013)Python Powered Data Science at Pivotal (PyData 2013)
Python Powered Data Science at Pivotal (PyData 2013)Srivatsan Ramanujam
 
Индексируем базу: как делать хорошо и не делать плохо Winter saint p 2021 m...
Индексируем базу: как делать хорошо и не делать плохо   Winter saint p 2021 m...Индексируем базу: как делать хорошо и не делать плохо   Winter saint p 2021 m...
Индексируем базу: как делать хорошо и не делать плохо Winter saint p 2021 m...Андрей Новиков
 
Mastering PostgreSQL Administration
Mastering PostgreSQL AdministrationMastering PostgreSQL Administration
Mastering PostgreSQL AdministrationCommand Prompt., Inc
 
Mastering PostgreSQL Administration
Mastering PostgreSQL AdministrationMastering PostgreSQL Administration
Mastering PostgreSQL AdministrationEDB
 
Pig power tools_by_viswanath_gangavaram
Pig power tools_by_viswanath_gangavaramPig power tools_by_viswanath_gangavaram
Pig power tools_by_viswanath_gangavaramViswanath Gangavaram
 
Massively Parallel Process with Prodedural Python by Ian Huston
Massively Parallel Process with Prodedural Python by Ian HustonMassively Parallel Process with Prodedural Python by Ian Huston
Massively Parallel Process with Prodedural Python by Ian HustonPyData
 
Inside PostgreSQL Shared Memory
Inside PostgreSQL Shared MemoryInside PostgreSQL Shared Memory
Inside PostgreSQL Shared MemoryEDB
 
PostgreSQL, Extensible to the Nth Degree: Functions, Languages, Types, Rules,...
PostgreSQL, Extensible to the Nth Degree: Functions, Languages, Types, Rules,...PostgreSQL, Extensible to the Nth Degree: Functions, Languages, Types, Rules,...
PostgreSQL, Extensible to the Nth Degree: Functions, Languages, Types, Rules,...Command Prompt., Inc
 
Introduction to pig.
Introduction to pig.Introduction to pig.
Introduction to pig.Triloki Gupta
 
Why Python (for Statisticians)
Why Python (for Statisticians)Why Python (for Statisticians)
Why Python (for Statisticians)Matt Harrison
 
Distributed tracing 101
Distributed tracing 101Distributed tracing 101
Distributed tracing 101Itiel Shwartz
 
Massively Parallel Processing with Procedural Python (PyData London 2014)
Massively Parallel Processing with Procedural Python (PyData London 2014)Massively Parallel Processing with Procedural Python (PyData London 2014)
Massively Parallel Processing with Procedural Python (PyData London 2014)Ian Huston
 
Cloudera Federal Forum 2014: Tracking Provenance in Hadoop Clusters
Cloudera Federal Forum 2014: Tracking Provenance in Hadoop ClustersCloudera Federal Forum 2014: Tracking Provenance in Hadoop Clusters
Cloudera Federal Forum 2014: Tracking Provenance in Hadoop ClustersCloudera, Inc.
 

Similar to PostgreSQL and Groonga Integration (20)

Extensions on PostgreSQL
Extensions on PostgreSQLExtensions on PostgreSQL
Extensions on PostgreSQL
 
Useful PostgreSQL Extensions
Useful PostgreSQL ExtensionsUseful PostgreSQL Extensions
Useful PostgreSQL Extensions
 
An Introduction to Postgresql
An Introduction to PostgresqlAn Introduction to Postgresql
An Introduction to Postgresql
 
Large scale crawling with Apache Nutch
Large scale crawling with Apache NutchLarge scale crawling with Apache Nutch
Large scale crawling with Apache Nutch
 
Python Powered Data Science at Pivotal (PyData 2013)
Python Powered Data Science at Pivotal (PyData 2013)Python Powered Data Science at Pivotal (PyData 2013)
Python Powered Data Science at Pivotal (PyData 2013)
 
Prashant_Agrawal_CV
Prashant_Agrawal_CVPrashant_Agrawal_CV
Prashant_Agrawal_CV
 
Prestogres internals
Prestogres internalsPrestogres internals
Prestogres internals
 
Индексируем базу: как делать хорошо и не делать плохо Winter saint p 2021 m...
Индексируем базу: как делать хорошо и не делать плохо   Winter saint p 2021 m...Индексируем базу: как делать хорошо и не делать плохо   Winter saint p 2021 m...
Индексируем базу: как делать хорошо и не делать плохо Winter saint p 2021 m...
 
Mastering PostgreSQL Administration
Mastering PostgreSQL AdministrationMastering PostgreSQL Administration
Mastering PostgreSQL Administration
 
Mastering PostgreSQL Administration
Mastering PostgreSQL AdministrationMastering PostgreSQL Administration
Mastering PostgreSQL Administration
 
Pig power tools_by_viswanath_gangavaram
Pig power tools_by_viswanath_gangavaramPig power tools_by_viswanath_gangavaram
Pig power tools_by_viswanath_gangavaram
 
Massively Parallel Process with Prodedural Python by Ian Huston
Massively Parallel Process with Prodedural Python by Ian HustonMassively Parallel Process with Prodedural Python by Ian Huston
Massively Parallel Process with Prodedural Python by Ian Huston
 
Inside PostgreSQL Shared Memory
Inside PostgreSQL Shared MemoryInside PostgreSQL Shared Memory
Inside PostgreSQL Shared Memory
 
PostgreSQL, Extensible to the Nth Degree: Functions, Languages, Types, Rules,...
PostgreSQL, Extensible to the Nth Degree: Functions, Languages, Types, Rules,...PostgreSQL, Extensible to the Nth Degree: Functions, Languages, Types, Rules,...
PostgreSQL, Extensible to the Nth Degree: Functions, Languages, Types, Rules,...
 
Introduction to pig.
Introduction to pig.Introduction to pig.
Introduction to pig.
 
Why Python (for Statisticians)
Why Python (for Statisticians)Why Python (for Statisticians)
Why Python (for Statisticians)
 
Distributed tracing 101
Distributed tracing 101Distributed tracing 101
Distributed tracing 101
 
Distributed Tracing
Distributed TracingDistributed Tracing
Distributed Tracing
 
Massively Parallel Processing with Procedural Python (PyData London 2014)
Massively Parallel Processing with Procedural Python (PyData London 2014)Massively Parallel Processing with Procedural Python (PyData London 2014)
Massively Parallel Processing with Procedural Python (PyData London 2014)
 
Cloudera Federal Forum 2014: Tracking Provenance in Hadoop Clusters
Cloudera Federal Forum 2014: Tracking Provenance in Hadoop ClustersCloudera Federal Forum 2014: Tracking Provenance in Hadoop Clusters
Cloudera Federal Forum 2014: Tracking Provenance in Hadoop Clusters
 

Recently uploaded

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
 
Vertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering TipsVertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering TipsMiki Katsuragi
 
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
 
WordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your BrandWordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your Brandgvaughan
 
Training state-of-the-art general text embedding
Training state-of-the-art general text embeddingTraining state-of-the-art general text embedding
Training state-of-the-art general text embeddingZilliz
 
Streamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupStreamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupFlorian Wilhelm
 
AI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsAI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsMemoori
 
Search Engine Optimization SEO PDF for 2024.pdf
Search Engine Optimization SEO PDF for 2024.pdfSearch Engine Optimization SEO PDF for 2024.pdf
Search Engine Optimization SEO PDF for 2024.pdfRankYa
 
Unraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfUnraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfAlex Barbosa Coqueiro
 
Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Mattias Andersson
 
Developer Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLDeveloper Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLScyllaDB
 
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Mark Simos
 
My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationMy Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationRidwan Fadjar
 
The Future of Software Development - Devin AI Innovative Approach.pdf
The Future of Software Development - Devin AI Innovative Approach.pdfThe Future of Software Development - Devin AI Innovative Approach.pdf
The Future of Software Development - Devin AI Innovative Approach.pdfSeasiaInfotech2
 
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
 
What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024Stephanie Beckett
 
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
"Federated learning: out of reach no matter how close",Oleksandr LapshynFwdays
 
Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024Enterprise Knowledge
 
"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
 
Scanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsScanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsRizwan Syed
 

Recently uploaded (20)

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
 
Vertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering TipsVertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering Tips
 
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
 
WordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your BrandWordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your Brand
 
Training state-of-the-art general text embedding
Training state-of-the-art general text embeddingTraining state-of-the-art general text embedding
Training state-of-the-art general text embedding
 
Streamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupStreamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project Setup
 
AI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsAI as an Interface for Commercial Buildings
AI as an Interface for Commercial Buildings
 
Search Engine Optimization SEO PDF for 2024.pdf
Search Engine Optimization SEO PDF for 2024.pdfSearch Engine Optimization SEO PDF for 2024.pdf
Search Engine Optimization SEO PDF for 2024.pdf
 
Unraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfUnraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdf
 
Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?
 
Developer Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLDeveloper Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQL
 
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
 
My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationMy Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 Presentation
 
The Future of Software Development - Devin AI Innovative Approach.pdf
The Future of Software Development - Devin AI Innovative Approach.pdfThe Future of Software Development - Devin AI Innovative Approach.pdf
The Future of Software Development - Devin AI Innovative Approach.pdf
 
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
 
What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024
 
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
 
Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024
 
"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
 
Scanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsScanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL Certs
 

PostgreSQL and Groonga Integration

  • 1. groonga with PostgreSQL 2011/11/29 groonga #2 & (@choplin) 1
  • 2. Agenda • Extensibility of PostgreSQL • How to work with groonga • textsearch_groonga • groonga_fdw 2
  • 4. Extensibility of PostgreSQL dblink, adminpack, pgcrypto, ... Parser cube,  ltree,  citext,  hstore,  json,  … Functions Data Types PL pl/R,  pl/v8js,  pl/Ruby,  pl/Lua,  … Optimizer pgadviser Executor Table auto_explain Index GiST/GIN, textsearch_senna, textsearch_groonga SQL/MED (9.1!) c.f.  external  tools:  pgpool,  slony,  pg_bulkload… ©2011 FORCIA, Inc. http://www.slideshare.net/HitoshiHarada/extensions-on-postgresql 4
  • 5. PGXN • PostgreSQL Extension Network • Central distribution system for PostgreSQL Extension • Inspired by CPAN for Perl library • Provides: • Manager, API, Search, Client • under development ... 5
  • 6. PGXN 6
  • 7. Only three steps to install an extension $ pgxn install tinyint $ psql # CREATE EXTENSION tinyint; --That’s all, yay! Coming soon 7
  • 8. How to work with groonga 8
  • 9. Extensibility of PostgreSQL dblink, adminpack, pgcrypto, ... Parser cube,  ltree,  citext,  hstore,  json,  … Functions Data Types PL pl/R,  pl/v8js,  pl/Ruby,  pl/Lua,  … Optimizer pgadviser Executor Table auto_explain Index GiST/GIN, textsearch_senna, textsearch_groonga SQL/MED (9.1!) c.f.  external  tools:  pgpool,  slony,  pg_bulkload… ©2011 FORCIA, Inc. http://www.slideshare.net/HitoshiHarada/extensions-on-postgresql 9
  • 10. Extensibility of PostgreSQL dblink, adminpack, pgcrypto, ... Parser cube,  ltree,  citext,  hstore,  json,  … Functions Data Types PL pl/R,  pl/v8js,  pl/Ruby,  pl/Lua,  … Optimizer pgadviser Executor auto_explain Table As Index Index GiST/GIN, textsearch_senna, textsearch_groonga SQL/MED (9.1!) c.f.  external  tools:  pgpool,  slony,  pg_bulkload… ©2011 FORCIA, Inc. http://www.slideshare.net/HitoshiHarada/extensions-on-postgresql 9
  • 11. Extensibility of PostgreSQL dblink, adminpack, pgcrypto, ... Parser cube,  ltree,  citext,  hstore,  json,  … Functions Data Types PL pl/R,  pl/v8js,  pl/Ruby,  pl/Lua,  … Optimizer pgadviser Executor auto_explain Table As Index As FDW Index GiST/GIN, textsearch_senna, textsearch_groonga SQL/MED (9.1!) groonga_fdw c.f.  external  tools:  pgpool,  slony,  pg_bulkload… ©2011 FORCIA, Inc. http://www.slideshare.net/HitoshiHarada/extensions-on-postgresql 9
  • 13. Full text search in PostgreSQL Builtin Extension Tsearch (8.3-) morphological + analysis textsearch_ja Ludia contrib/pg_trgm N-gram textsearch_senna (9.1-) textsearch_groonga https://docs.google.com/present/view?id=dhk2smpg_3h44cnrdv 11
  • 14. Motivation textsearch_groonga • textsearch_ja ( ) • textsearch_senna (N-gram) PostgreSQL 8.3 HOT Senna … • textsearch_groonga ©2010 FORCIA, Inc. http://www.slideshare.net/ItagakiTakahiro/textsearch-groonga-v01 12
  • 15. Indexing : • CREATE TABLE tbl(id serial, doc text); • COPY tbl(doc) FROM '...'; -- • CREATE INDEX idx ON tbl USING groonga (doc); CTID _key CTID _key (1, 0) foo 1.5 1 bar (1, 1) ar 1 (1, 1) bar 2.0 2 baz (2, 0) az 2 (2, 0) baz 4.5 3 foo (1,0) ba 1, 2 CTID = fo 3 oo 3 PostgreSQL groonga groonga ©2010 FORCIA, Inc. http://www.slideshare.net/ItagakiTakahiro/textsearch-groonga-v01 13
  • 16. Querying : • SELECT * FROM tbl WHERE … – • doc = ' '– – <, <=, =, >=, >, <> • – • doc %% ' ' – N-gram • – grn_expr • doc @@ groonga.query(' ', ' ') • ©2010 FORCIA, Inc. http://www.slideshare.net/ItagakiTakahiro/textsearch-groonga-v01 14
  • 18. SQL/MED • Management of External Data • SQL Standard (SQL:2003) • Consists: • Foreign Table • DATALINK 16
  • 19. SQL/MED • Management of External Data • SQL Standard (SQL:2003) • Consists: • Foreign Table Implemented as FDW in Postgres • DATALINK 16
  • 20. FDW • Foreign Data Wrapper • External data as Table of PostgreSQL • Available from 9.1 • Only “SELECT” statement is available now • Very simple API interface • Only 6 callbacks are required :) 17
  • 21. FDW Internal Parser Planner Executer Storage 18
  • 22. FDW Internal Parser Planner Executer Storage External Data FDW 18
  • 23. FDW • Example: • Oracle • MySQL • Redis • Amazon S3 • Twitter • and more... (see http://pgxn.org/tag/fdw/ ) 19
  • 24. groonga_fdw • Foreign Data Wrapper for groonga • You can query groonga via postgres with usual SQL • Under Development 20
  • 25. How to use Install # CREATE EXTENTION groonga_fdw; # CREATE SERVER groonga_server FOREIGN DATA WRAPPER groonga_fdw Connect OPTIONS ( dbpath ‘ ); # CREATE FOREIGN TABLE groonga_fdw_tutorial ( _key text title text ) Table SERVER groonga_server OPTIONS ( ... ); 21
  • 26. How to use Query # SELECT * FROM groonga_fdw_tutorial; 22
  • 27. Compare • textsearch_groonga • <-> Tritton • groonga_fdw • <-> mroonga 23
  • 28. Summary • PostgreSQL is quite extensible • Two ways to work with groonga • textsearch_groonga • groonga_fdw • PostgreSQL and groonga are good friend :) 24
  • 29. Thanks! 25