SlideShare a Scribd company logo
SQL/MED
Doping for PostgreSQL


   Peter Eisentraut

  Senior Software Engineer
     Lab Development
   F-Secure Corporation


     PGCon 2009
SQL/MED: Management of External Data




     MED = Management of External
     Data
     Methods to access data stored
     outside the database system
     through normal SQL
     SQL/MED is ISO/IEC 9075-9
Applications and Use Cases


     Connect to other DBMS (like DBI-Link)
         Other primary data storage: Oracle, MySQL, . . .
         Data warehouses etc.: Greenplum, Truviso, . . .
     Connect to other PostgreSQL instances (like dblink)
     Read non-SQL data
         Files: CSV, XML, JSON, . . .
         File systems: Google FS, Hadoop FS, Lustre, . . .
         Databases: CouchDB, BigTable, NDB, S3, . . . (“Cloud” stuff)
         Memcache
     Clustering, partitioning (think PL/Proxy)
     Manage data stored in file system
         Images
         Video
         Engineering data
Applications and Use Cases


     Connect to other DBMS (like DBI-Link)
         Other primary data storage: Oracle, MySQL, . . .
         Data warehouses etc.: Greenplum, Truviso, . . .
     Connect to other PostgreSQL instances (like dblink)
     Read non-SQL data
         Files: CSV, XML, JSON, . . .
         File systems: Google FS, Hadoop FS, Lustre, . . .
         Databases: CouchDB, BigTable, NDB, S3, . . . (“Cloud” stuff)
         Memcache
     Clustering, partitioning (think PL/Proxy)
     Manage data stored in file system
         Images
         Video
         Engineering data
Why do we care?


     Unifies existing ad-hoc solutions.
     Powerful new functionality
     Makes PostgreSQL the center of data management.
     Implementation has begun in PostgreSQL 8.4.
     Several people have plans for PostgreSQL 8.5.
     See status report later in this presentation.
Advantages




  Schema integration All data appears as tables.
  Access control Use GRANT/REVOKE for everything.
  Standard APIs Mix and share.
  Centralized control Manage all data through the DBMS.
Implications for Application Design and
Deployment



  Before



           application   application   application   application   application




                         MySQL         MySQL         PostgreSQL    file system
           Oracle
                                       Cluster
Implications for Application Design and
Deployment


  After

          application   application   application   application   application




                                      PostgreSQL




                        MySQL         MySQL         file system
          Oracle                                                  CouchDB
                                      Cluster
The Two Parts of SQL/MED


  Wrapper interface Access other data sources, represent them
             as SQL tables
   Datalinks Manage files stored in file system, represent file
             references as column values
Wrapper Interface Concepts




     Define a foreign table . . .

     On a foreign server . . .

     Accessed through a foreign-data wrapper
Wrapper Interface Concepts




     Define a foreign table . . .
          think: a dblink view
     On a foreign server . . .
          think: dblink_connect
     Accessed through a foreign-data wrapper
          think: dblink.so library
Foreign-Data Wrappers

  Foreign-data wrapper (FDW): a library that can communicate
  with external data sources

  CREATE FOREIGN DATA WRAPPER foosql
    LIBRARY 'foosql_fdw.so'
    LANGUAGE C;

      PostgreSQL communicates with foosql_fdw.so using
      SQL/MED FDW API.
      foosql_fdw.so communicates with FooSQL server using
      their own protocol.
      In theory, FooSQL, Inc. would ship foosql_fdw.so with
      their product.
      In practice, this is not so wide-spread.
Foreign Servers




  Foreign server: an instance of an external data source
  accessed through a FDW

  CREATE SERVER extradb
    FOREIGN DATA WRAPPER foosql
    OPTIONS (host 'foo.example.com', port '2345');

      Options depend on FDW.
User Mappings



  User mapping: additional user-specific options for a foreign
  server

  CREATE USER MAPPING FOR peter SERVER extradb
    OPTIONS (user 'peter', password 'seKret');

      Options depend on FDW.
      Putting connection options into server vs. user mapping is
      a matter of convention or convenience.
Foreign Tables



  Foreign table: a table stored on a foreign server

  CREATE FOREIGN TABLE data
    SERVER extradb
    OPTIONS (tablename 'DATA123');

      Now you can read and write the table as if it were local
      (depending on FDW features/implementation).
      Options specified for FDW, server, and user mapping are
      used as connection parameters (depending on FDW).
Another Wrapper Interface Example

  Possible setup for accessing HTML tables stored in a web site
  as SQL tables:

  CREATE FOREIGN DATA WRAPPER htmlfile
    LIBRARY 'html_fdw.so'
    LANGUAGE C;

  CREATE SERVER intranetweb
    FOREIGN DATA WRAPPER htmlfile
    OPTIONS (baseurl 'http://intranet/data');

  CREATE FOREIGN TABLE data
    SERVER intranetweb
    OPTIONS (path 'foo.html#//table[@id="table1"]');
Routine Mappings




  Routine mappings: passing a function/procedure through to a
  foreign server

  CREATE ROUTINE MAPPING <routine mapping name>
    FOR <specific routine designator>
    SERVER <foreign server name>
    [ <generic options> ];
Routine Mappings Examples



  Example like PL/Proxy:

  CREATE ROUTINE MAPPING myfunc(a int, b text)
    SERVER plproxydb
    OPTIONS (cluster 'somecluster',
             runon 'hashtext(a)');
  Example XML-RPC:

  CREATE ROUTINE MAPPING process(data xml)
    SERVER xmlrpc
    OPTIONS (request '<methodCall>...</methodCall>');
Wrapper Interface Access Control




     GRANT USAGE ON FOREIGN DATA WRAPPER
     GRANT USAGE FOREIGN SERVER
     Foreign tables and routines have regular privileges.
     Passwords for remote access can be managed via user
     mappings.
     Front-to-end Kerberos or SSL support could be cool.
Importing Foreign Schemas




  Automatically create foreign tables based on tables available
  remotely.

  IMPORT FOREIGN SCHEMA someschema
    LIMIT TO (tab1, tab2, tab2)
    FROM SERVER extradb
    INTO myschema;
  (SQL standard doesn’t support foreign routine import.)
Status of SQL/MED in PostgreSQL 8.4




  PostgreSQL 8.4 has:
      CREATE FOREIGN DATA WRAPPER, but no library support
      CREATE SERVER
      CREATE USER MAPPING
      ACL support
      Doesn’t really do anything :-(
      Plans for PL/Proxy to store connection information
Status of SQL/MED Elsewhere




     IBM DB2 provides a full implementation.
     MySQL and Farrago use some syntax elements.
     No other known implementations.
     Some vendors have had their custom remote access
     functionality.
Plan & Issues



  PostgreSQL 8.5 and beyond . . .
      Write wrapper library and foreign table support
      Supply a few foreign-data wrapper libraries
      Use standard wrapper interface API or design our own
      API?
      Optimizations, e. g., passing query qualifications to foreign
      servers
      Distributed transactions
      Needs careful security evaluation (remember dblink issues)
Plan & Issues



  PostgreSQL 8.5 and beyond . . .
      Write wrapper library and foreign table support
      Supply a few foreign-data wrapper libraries
      Use standard wrapper interface API or design our own
      API?
      Optimizations, e. g., passing query qualifications to foreign
      servers
      Distributed transactions
      Needs careful security evaluation (remember dblink issues)
Datalink Concepts




     Files are referenced through a new DATALINK type
     Database system has control over external files
     No need to store file contents in database system
     Access control and integrity mechanisms of DBMS can be
     extended to file system
Datalink Use Cases




     Certain types of data are primarily uses as files with
     external applications.
     Handling very large files (e. g., video) by DBMS is
     inefficient
     Use of distributed files systems
     Handle files stored on web server, FTP server, etc.
Example: Simple DATALINK Type


  CREATE TABLE persons (
    id      integer,
    name    text,
    picture DATALINK [NO LINK CONTROL]
  );

  INSERT INTO persons VALUES (
    1,
    'Jon Doe',
    DLVALUE('file://some/where/1.jpg')
  );

     SQL specifies support for file: and http:.
     This variant doesn’t do anything except store URLs.
DATALINK Attributes: Link and Integrity Control



  NO LINK CONTROL Datalink value need not reference an
            existing file/URL.
  FILE LINK CONTROL Datalink value must reference an
             existing file/URL.

  INTEGRITY ALL Referenced files can only be renamed or
            deleted through SQL.
  INTEGRITY SELECTIVE Referenced files can be renamed or
            deleted through SQL or directly.
  INTEGRITY NONE (implied for NO LINK CONTROL)
DATALINK Attributes: Unlinking and Recovery
Behavior



  ON UNLINK DELETE File is deleted from file system when
            deleted from database.
  ON UNLINK RESTORE File’s original permissions are
            restored when deleted from database.
  ON UNLINK NONE No change in file permissions when file
            reference is deleted from database.

  RECOVERY YES PITR applies to referenced files.
  RECOVERY NO PITR does not apply to referenced files.
DATALINK Attributes: Access Permissions



  READ PERMISSION FS File system controls file read
           permission.
  READ PERMISSION DB Database system controls file read
           permission.

  WRITE PERMISSION FS File system controls file write
           permission.
  WRITE PERMISSION ADMIN Writes to the file are managed
           by the database system.
  WRITE PERMISSION BLOCKED Writing to file is blocked.
How to Implement Datalinks


  Implementation challenges:
       OS-dependent
       File-system dependent
       Application-dependent
  Possibilities:
       Kernel modules
       LD_PRELOAD
       Extended FS attributes
       Lots of hocus pocus
  Don’t hold your breath.
Summary


  SQL/MED

        Wrapper interface
        Datalinks
        Substantial support planned for PostgreSQL 8.5 and
        beyond


  Further reading:
        http://wiki.postgresql.org/wiki/SqlMedConnectionManager
        (Martin Pihlak)
        http://www.sigmod.org/record/issues/0103/JM-Sta.pdf (Jim Melton et al.)
        http://www.sigmod.org/record/issues/0209/jimmelton.pdf
        (Jim Melton et al.)
        ISO/IEC 9075-9:2008 (“SQL/MED”)
Rights and Attributions




  This presentation “SQL/MED: Doping for PostgreSQL” was authored by Peter Eisentraut and is licensed under the
  Creative Commons Attribution-Noncommercial-Share Alike 3.0 Unported license.

         The image on page 2 is from the Open Clip Art Library and is in the public domain.
         The image on page 5 is from the Open Clip Art Library and is in the public domain.
         The image on page 9 is “The fork in the road” by Flickr user i_yudai, available under the Creative Commons
         Attribution 2.0 Generic license.
         The image on page 31 is “Fork in a Steve” by Flickr user morgantepsic, available under the Creative
         Commons Attribution-Share Alike 2.0 Generic license.
Ad

More Related Content

What's hot (20)

Introduction to oracle(2)
Introduction to oracle(2)Introduction to oracle(2)
Introduction to oracle(2)
Sumit Tambe
 
Introduction to oracle
Introduction to oracleIntroduction to oracle
Introduction to oracle
Madhavendra Dutt
 
Sql lite android
Sql lite androidSql lite android
Sql lite android
Dushyant Nasit
 
File character set converter
File character set converterFile character set converter
File character set converter
Deepti Singh
 
File character set converter
File character set converterFile character set converter
File character set converter
Deepti Singh
 
Persitance Data with sqlite
Persitance Data with sqlitePersitance Data with sqlite
Persitance Data with sqlite
Arif Huda
 
Information Retrieval - Data Science Bootcamp
Information Retrieval - Data Science BootcampInformation Retrieval - Data Science Bootcamp
Information Retrieval - Data Science Bootcamp
Kais Hassan, PhD
 
[Android] Data Storage
[Android] Data Storage[Android] Data Storage
[Android] Data Storage
Nikmesoft Ltd
 
Real World Experience With Oracle Xml Database 11g An Oracle Ace’s Perspectiv...
Real World Experience With Oracle Xml Database 11g An Oracle Ace’s Perspectiv...Real World Experience With Oracle Xml Database 11g An Oracle Ace’s Perspectiv...
Real World Experience With Oracle Xml Database 11g An Oracle Ace’s Perspectiv...
Marco Gralike
 
Euclid Data Model 101 - Episode 01: Overview
Euclid Data Model 101 - Episode 01: OverviewEuclid Data Model 101 - Episode 01: Overview
Euclid Data Model 101 - Episode 01: Overview
euc-dm-test
 
DbVisualizer for NonStop SQL
DbVisualizer for NonStop SQLDbVisualizer for NonStop SQL
DbVisualizer for NonStop SQL
Frans Jongma
 
Building your own search engine with Apache Solr
Building your own search engine with Apache SolrBuilding your own search engine with Apache Solr
Building your own search engine with Apache Solr
Biogeeks
 
Android datastorage
Android datastorageAndroid datastorage
Android datastorage
Krazy Koder
 
NonStop SQL/MX DBS demo with iTP Webserver
NonStop SQL/MX DBS demo with iTP WebserverNonStop SQL/MX DBS demo with iTP Webserver
NonStop SQL/MX DBS demo with iTP Webserver
Frans Jongma
 
MySQL 8 Server Optimization Swanseacon 2018
MySQL 8 Server Optimization Swanseacon 2018MySQL 8 Server Optimization Swanseacon 2018
MySQL 8 Server Optimization Swanseacon 2018
Dave Stokes
 
Elasticsearch, a distributed search engine with real-time analytics
Elasticsearch, a distributed search engine with real-time analyticsElasticsearch, a distributed search engine with real-time analytics
Elasticsearch, a distributed search engine with real-time analytics
Tiziano Fagni
 
Intro to T-SQL – 2nd session
Intro to T-SQL – 2nd sessionIntro to T-SQL – 2nd session
Intro to T-SQL – 2nd session
Medhat Dawoud
 
Sqlite
SqliteSqlite
Sqlite
Kumar
 
Apache solr
Apache solrApache solr
Apache solr
Dipen Rangwani
 
XFILES, The APEX 4 version - The truth is in there
XFILES, The APEX 4 version - The truth is in thereXFILES, The APEX 4 version - The truth is in there
XFILES, The APEX 4 version - The truth is in there
Marco Gralike
 
Introduction to oracle(2)
Introduction to oracle(2)Introduction to oracle(2)
Introduction to oracle(2)
Sumit Tambe
 
File character set converter
File character set converterFile character set converter
File character set converter
Deepti Singh
 
File character set converter
File character set converterFile character set converter
File character set converter
Deepti Singh
 
Persitance Data with sqlite
Persitance Data with sqlitePersitance Data with sqlite
Persitance Data with sqlite
Arif Huda
 
Information Retrieval - Data Science Bootcamp
Information Retrieval - Data Science BootcampInformation Retrieval - Data Science Bootcamp
Information Retrieval - Data Science Bootcamp
Kais Hassan, PhD
 
[Android] Data Storage
[Android] Data Storage[Android] Data Storage
[Android] Data Storage
Nikmesoft Ltd
 
Real World Experience With Oracle Xml Database 11g An Oracle Ace’s Perspectiv...
Real World Experience With Oracle Xml Database 11g An Oracle Ace’s Perspectiv...Real World Experience With Oracle Xml Database 11g An Oracle Ace’s Perspectiv...
Real World Experience With Oracle Xml Database 11g An Oracle Ace’s Perspectiv...
Marco Gralike
 
Euclid Data Model 101 - Episode 01: Overview
Euclid Data Model 101 - Episode 01: OverviewEuclid Data Model 101 - Episode 01: Overview
Euclid Data Model 101 - Episode 01: Overview
euc-dm-test
 
DbVisualizer for NonStop SQL
DbVisualizer for NonStop SQLDbVisualizer for NonStop SQL
DbVisualizer for NonStop SQL
Frans Jongma
 
Building your own search engine with Apache Solr
Building your own search engine with Apache SolrBuilding your own search engine with Apache Solr
Building your own search engine with Apache Solr
Biogeeks
 
Android datastorage
Android datastorageAndroid datastorage
Android datastorage
Krazy Koder
 
NonStop SQL/MX DBS demo with iTP Webserver
NonStop SQL/MX DBS demo with iTP WebserverNonStop SQL/MX DBS demo with iTP Webserver
NonStop SQL/MX DBS demo with iTP Webserver
Frans Jongma
 
MySQL 8 Server Optimization Swanseacon 2018
MySQL 8 Server Optimization Swanseacon 2018MySQL 8 Server Optimization Swanseacon 2018
MySQL 8 Server Optimization Swanseacon 2018
Dave Stokes
 
Elasticsearch, a distributed search engine with real-time analytics
Elasticsearch, a distributed search engine with real-time analyticsElasticsearch, a distributed search engine with real-time analytics
Elasticsearch, a distributed search engine with real-time analytics
Tiziano Fagni
 
Intro to T-SQL – 2nd session
Intro to T-SQL – 2nd sessionIntro to T-SQL – 2nd session
Intro to T-SQL – 2nd session
Medhat Dawoud
 
Sqlite
SqliteSqlite
Sqlite
Kumar
 
XFILES, The APEX 4 version - The truth is in there
XFILES, The APEX 4 version - The truth is in thereXFILES, The APEX 4 version - The truth is in there
XFILES, The APEX 4 version - The truth is in there
Marco Gralike
 

Similar to SQL/MED: Doping for PostgreSQL (20)

Quantopix analytics system (qas)
Quantopix analytics system (qas)Quantopix analytics system (qas)
Quantopix analytics system (qas)
Al Sabawi
 
Foreign Data Wrappers and You with Postgres
Foreign Data Wrappers and You with PostgresForeign Data Wrappers and You with Postgres
Foreign Data Wrappers and You with Postgres
EDB
 
PGConf.ASIA 2019 Bali - A step towards SQL/MED - DATALINK - Gilles Darold
PGConf.ASIA 2019 Bali - A step towards SQL/MED - DATALINK - Gilles DaroldPGConf.ASIA 2019 Bali - A step towards SQL/MED - DATALINK - Gilles Darold
PGConf.ASIA 2019 Bali - A step towards SQL/MED - DATALINK - Gilles Darold
Equnix Business Solutions
 
Big Data: SQL on Hadoop from IBM
Big Data:  SQL on Hadoop from IBM Big Data:  SQL on Hadoop from IBM
Big Data: SQL on Hadoop from IBM
Cynthia Saracco
 
Sql azure dec_2010 Lynn & Ike
Sql azure dec_2010 Lynn & IkeSql azure dec_2010 Lynn & Ike
Sql azure dec_2010 Lynn & Ike
Ike Ellis
 
Introduction to firebidSQL 3.x
Introduction to firebidSQL 3.xIntroduction to firebidSQL 3.x
Introduction to firebidSQL 3.x
Fabio Codebue
 
Federated Queries Across Both Different Storage Mediums and Different Data En...
Federated Queries Across Both Different Storage Mediums and Different Data En...Federated Queries Across Both Different Storage Mediums and Different Data En...
Federated Queries Across Both Different Storage Mediums and Different Data En...
VMware Tanzu
 
KoprowskiT_SQLSat230_Rheinland_SQLAzure-fromPlantoBackuptoCloud
KoprowskiT_SQLSat230_Rheinland_SQLAzure-fromPlantoBackuptoCloudKoprowskiT_SQLSat230_Rheinland_SQLAzure-fromPlantoBackuptoCloud
KoprowskiT_SQLSat230_Rheinland_SQLAzure-fromPlantoBackuptoCloud
Tobias Koprowski
 
Hadoop_arunam_ppt
Hadoop_arunam_pptHadoop_arunam_ppt
Hadoop_arunam_ppt
jerrin joseph
 
HadoopDB
HadoopDBHadoopDB
HadoopDB
Miguel Pastor
 
Data Analytics Meetup: Introduction to Azure Data Lake Storage
Data Analytics Meetup: Introduction to Azure Data Lake Storage Data Analytics Meetup: Introduction to Azure Data Lake Storage
Data Analytics Meetup: Introduction to Azure Data Lake Storage
CCG
 
Obevo Javasig.pptx
Obevo Javasig.pptxObevo Javasig.pptx
Obevo Javasig.pptx
LadduAnanu
 
Denodo Partner Connect: Technical Webinar - Ask Me Anything
Denodo Partner Connect: Technical Webinar - Ask Me AnythingDenodo Partner Connect: Technical Webinar - Ask Me Anything
Denodo Partner Connect: Technical Webinar - Ask Me Anything
Denodo
 
MS-SQL SERVER ARCHITECTURE
MS-SQL SERVER ARCHITECTUREMS-SQL SERVER ARCHITECTURE
MS-SQL SERVER ARCHITECTURE
Douglas Bernardini
 
PASS Summit - SQL Server 2017 Deep Dive
PASS Summit - SQL Server 2017 Deep DivePASS Summit - SQL Server 2017 Deep Dive
PASS Summit - SQL Server 2017 Deep Dive
Travis Wright
 
Sql server basics
Sql server basicsSql server basics
Sql server basics
Dilfaroz Khan
 
FIWARE Global Summit - A Multi-database Plugin for the Orion FIWARE Context B...
FIWARE Global Summit - A Multi-database Plugin for the Orion FIWARE Context B...FIWARE Global Summit - A Multi-database Plugin for the Orion FIWARE Context B...
FIWARE Global Summit - A Multi-database Plugin for the Orion FIWARE Context B...
FIWARE
 
Azure Data platform
Azure Data platformAzure Data platform
Azure Data platform
Mostafa
 
Chapter 4 event it theory programming.pptx
Chapter 4 event it theory programming.pptxChapter 4 event it theory programming.pptx
Chapter 4 event it theory programming.pptx
kmkkali41
 
PHP Oracle
PHP OraclePHP Oracle
PHP Oracle
Nur Hidayat
 
Quantopix analytics system (qas)
Quantopix analytics system (qas)Quantopix analytics system (qas)
Quantopix analytics system (qas)
Al Sabawi
 
Foreign Data Wrappers and You with Postgres
Foreign Data Wrappers and You with PostgresForeign Data Wrappers and You with Postgres
Foreign Data Wrappers and You with Postgres
EDB
 
PGConf.ASIA 2019 Bali - A step towards SQL/MED - DATALINK - Gilles Darold
PGConf.ASIA 2019 Bali - A step towards SQL/MED - DATALINK - Gilles DaroldPGConf.ASIA 2019 Bali - A step towards SQL/MED - DATALINK - Gilles Darold
PGConf.ASIA 2019 Bali - A step towards SQL/MED - DATALINK - Gilles Darold
Equnix Business Solutions
 
Big Data: SQL on Hadoop from IBM
Big Data:  SQL on Hadoop from IBM Big Data:  SQL on Hadoop from IBM
Big Data: SQL on Hadoop from IBM
Cynthia Saracco
 
Sql azure dec_2010 Lynn & Ike
Sql azure dec_2010 Lynn & IkeSql azure dec_2010 Lynn & Ike
Sql azure dec_2010 Lynn & Ike
Ike Ellis
 
Introduction to firebidSQL 3.x
Introduction to firebidSQL 3.xIntroduction to firebidSQL 3.x
Introduction to firebidSQL 3.x
Fabio Codebue
 
Federated Queries Across Both Different Storage Mediums and Different Data En...
Federated Queries Across Both Different Storage Mediums and Different Data En...Federated Queries Across Both Different Storage Mediums and Different Data En...
Federated Queries Across Both Different Storage Mediums and Different Data En...
VMware Tanzu
 
KoprowskiT_SQLSat230_Rheinland_SQLAzure-fromPlantoBackuptoCloud
KoprowskiT_SQLSat230_Rheinland_SQLAzure-fromPlantoBackuptoCloudKoprowskiT_SQLSat230_Rheinland_SQLAzure-fromPlantoBackuptoCloud
KoprowskiT_SQLSat230_Rheinland_SQLAzure-fromPlantoBackuptoCloud
Tobias Koprowski
 
Data Analytics Meetup: Introduction to Azure Data Lake Storage
Data Analytics Meetup: Introduction to Azure Data Lake Storage Data Analytics Meetup: Introduction to Azure Data Lake Storage
Data Analytics Meetup: Introduction to Azure Data Lake Storage
CCG
 
Obevo Javasig.pptx
Obevo Javasig.pptxObevo Javasig.pptx
Obevo Javasig.pptx
LadduAnanu
 
Denodo Partner Connect: Technical Webinar - Ask Me Anything
Denodo Partner Connect: Technical Webinar - Ask Me AnythingDenodo Partner Connect: Technical Webinar - Ask Me Anything
Denodo Partner Connect: Technical Webinar - Ask Me Anything
Denodo
 
PASS Summit - SQL Server 2017 Deep Dive
PASS Summit - SQL Server 2017 Deep DivePASS Summit - SQL Server 2017 Deep Dive
PASS Summit - SQL Server 2017 Deep Dive
Travis Wright
 
FIWARE Global Summit - A Multi-database Plugin for the Orion FIWARE Context B...
FIWARE Global Summit - A Multi-database Plugin for the Orion FIWARE Context B...FIWARE Global Summit - A Multi-database Plugin for the Orion FIWARE Context B...
FIWARE Global Summit - A Multi-database Plugin for the Orion FIWARE Context B...
FIWARE
 
Azure Data platform
Azure Data platformAzure Data platform
Azure Data platform
Mostafa
 
Chapter 4 event it theory programming.pptx
Chapter 4 event it theory programming.pptxChapter 4 event it theory programming.pptx
Chapter 4 event it theory programming.pptx
kmkkali41
 
Ad

More from Peter Eisentraut (20)

Programming with Python and PostgreSQL
Programming with Python and PostgreSQLProgramming with Python and PostgreSQL
Programming with Python and PostgreSQL
Peter Eisentraut
 
Getting Started with PL/Proxy
Getting Started with PL/ProxyGetting Started with PL/Proxy
Getting Started with PL/Proxy
Peter Eisentraut
 
Linux distribution for the cloud
Linux distribution for the cloudLinux distribution for the cloud
Linux distribution for the cloud
Peter Eisentraut
 
Porting Applications From Oracle To PostgreSQL
Porting Applications From Oracle To PostgreSQLPorting Applications From Oracle To PostgreSQL
Porting Applications From Oracle To PostgreSQL
Peter Eisentraut
 
Porting Oracle Applications to PostgreSQL
Porting Oracle Applications to PostgreSQLPorting Oracle Applications to PostgreSQL
Porting Oracle Applications to PostgreSQL
Peter Eisentraut
 
PostgreSQL and XML
PostgreSQL and XMLPostgreSQL and XML
PostgreSQL and XML
Peter Eisentraut
 
XML Support: Specifications and Development
XML Support: Specifications and DevelopmentXML Support: Specifications and Development
XML Support: Specifications and Development
Peter Eisentraut
 
PostgreSQL: Die Freie Datenbankalternative
PostgreSQL: Die Freie DatenbankalternativePostgreSQL: Die Freie Datenbankalternative
PostgreSQL: Die Freie Datenbankalternative
Peter Eisentraut
 
The Road to the XML Type: Current and Future Developments
The Road to the XML Type: Current and Future DevelopmentsThe Road to the XML Type: Current and Future Developments
The Road to the XML Type: Current and Future Developments
Peter Eisentraut
 
Access ohne Access: Freie Datenbank-Frontends
Access ohne Access: Freie Datenbank-FrontendsAccess ohne Access: Freie Datenbank-Frontends
Access ohne Access: Freie Datenbank-Frontends
Peter Eisentraut
 
PostgreSQL and PL/Java
PostgreSQL and PL/JavaPostgreSQL and PL/Java
PostgreSQL and PL/Java
Peter Eisentraut
 
Replication Solutions for PostgreSQL
Replication Solutions for PostgreSQLReplication Solutions for PostgreSQL
Replication Solutions for PostgreSQL
Peter Eisentraut
 
PostgreSQL News
PostgreSQL NewsPostgreSQL News
PostgreSQL News
Peter Eisentraut
 
PostgreSQL News
PostgreSQL NewsPostgreSQL News
PostgreSQL News
Peter Eisentraut
 
Access ohne Access: Freie Datenbank-Frontends
Access ohne Access: Freie Datenbank-FrontendsAccess ohne Access: Freie Datenbank-Frontends
Access ohne Access: Freie Datenbank-Frontends
Peter Eisentraut
 
Docbook: Textverarbeitung mit XML
Docbook: Textverarbeitung mit XMLDocbook: Textverarbeitung mit XML
Docbook: Textverarbeitung mit XML
Peter Eisentraut
 
Collateral Damage: Consequences of Spam and Virus Filtering for the E-Mail Sy...
Collateral Damage: Consequences of Spam and Virus Filtering for the E-Mail Sy...Collateral Damage: Consequences of Spam and Virus Filtering for the E-Mail Sy...
Collateral Damage: Consequences of Spam and Virus Filtering for the E-Mail Sy...
Peter Eisentraut
 
Collateral Damage: Consequences of Spam and Virus Filtering for the E-Mail S...
Collateral Damage:
Consequences of Spam and Virus Filtering for the E-Mail S...Collateral Damage:
Consequences of Spam and Virus Filtering for the E-Mail S...
Collateral Damage: Consequences of Spam and Virus Filtering for the E-Mail S...
Peter Eisentraut
 
Spaß mit PostgreSQL
Spaß mit PostgreSQLSpaß mit PostgreSQL
Spaß mit PostgreSQL
Peter Eisentraut
 
The Common Debian Build System (CDBS)
The Common Debian Build System (CDBS)The Common Debian Build System (CDBS)
The Common Debian Build System (CDBS)
Peter Eisentraut
 
Programming with Python and PostgreSQL
Programming with Python and PostgreSQLProgramming with Python and PostgreSQL
Programming with Python and PostgreSQL
Peter Eisentraut
 
Getting Started with PL/Proxy
Getting Started with PL/ProxyGetting Started with PL/Proxy
Getting Started with PL/Proxy
Peter Eisentraut
 
Linux distribution for the cloud
Linux distribution for the cloudLinux distribution for the cloud
Linux distribution for the cloud
Peter Eisentraut
 
Porting Applications From Oracle To PostgreSQL
Porting Applications From Oracle To PostgreSQLPorting Applications From Oracle To PostgreSQL
Porting Applications From Oracle To PostgreSQL
Peter Eisentraut
 
Porting Oracle Applications to PostgreSQL
Porting Oracle Applications to PostgreSQLPorting Oracle Applications to PostgreSQL
Porting Oracle Applications to PostgreSQL
Peter Eisentraut
 
XML Support: Specifications and Development
XML Support: Specifications and DevelopmentXML Support: Specifications and Development
XML Support: Specifications and Development
Peter Eisentraut
 
PostgreSQL: Die Freie Datenbankalternative
PostgreSQL: Die Freie DatenbankalternativePostgreSQL: Die Freie Datenbankalternative
PostgreSQL: Die Freie Datenbankalternative
Peter Eisentraut
 
The Road to the XML Type: Current and Future Developments
The Road to the XML Type: Current and Future DevelopmentsThe Road to the XML Type: Current and Future Developments
The Road to the XML Type: Current and Future Developments
Peter Eisentraut
 
Access ohne Access: Freie Datenbank-Frontends
Access ohne Access: Freie Datenbank-FrontendsAccess ohne Access: Freie Datenbank-Frontends
Access ohne Access: Freie Datenbank-Frontends
Peter Eisentraut
 
Replication Solutions for PostgreSQL
Replication Solutions for PostgreSQLReplication Solutions for PostgreSQL
Replication Solutions for PostgreSQL
Peter Eisentraut
 
Access ohne Access: Freie Datenbank-Frontends
Access ohne Access: Freie Datenbank-FrontendsAccess ohne Access: Freie Datenbank-Frontends
Access ohne Access: Freie Datenbank-Frontends
Peter Eisentraut
 
Docbook: Textverarbeitung mit XML
Docbook: Textverarbeitung mit XMLDocbook: Textverarbeitung mit XML
Docbook: Textverarbeitung mit XML
Peter Eisentraut
 
Collateral Damage: Consequences of Spam and Virus Filtering for the E-Mail Sy...
Collateral Damage: Consequences of Spam and Virus Filtering for the E-Mail Sy...Collateral Damage: Consequences of Spam and Virus Filtering for the E-Mail Sy...
Collateral Damage: Consequences of Spam and Virus Filtering for the E-Mail Sy...
Peter Eisentraut
 
Collateral Damage: Consequences of Spam and Virus Filtering for the E-Mail S...
Collateral Damage:
Consequences of Spam and Virus Filtering for the E-Mail S...Collateral Damage:
Consequences of Spam and Virus Filtering for the E-Mail S...
Collateral Damage: Consequences of Spam and Virus Filtering for the E-Mail S...
Peter Eisentraut
 
The Common Debian Build System (CDBS)
The Common Debian Build System (CDBS)The Common Debian Build System (CDBS)
The Common Debian Build System (CDBS)
Peter Eisentraut
 
Ad

Recently uploaded (20)

Semantic Cultivators : The Critical Future Role to Enable AI
Semantic Cultivators : The Critical Future Role to Enable AISemantic Cultivators : The Critical Future Role to Enable AI
Semantic Cultivators : The Critical Future Role to Enable AI
artmondano
 
TrsLabs - Fintech Product & Business Consulting
TrsLabs - Fintech Product & Business ConsultingTrsLabs - Fintech Product & Business Consulting
TrsLabs - Fintech Product & Business Consulting
Trs Labs
 
AI Changes Everything – Talk at Cardiff Metropolitan University, 29th April 2...
AI Changes Everything – Talk at Cardiff Metropolitan University, 29th April 2...AI Changes Everything – Talk at Cardiff Metropolitan University, 29th April 2...
AI Changes Everything – Talk at Cardiff Metropolitan University, 29th April 2...
Alan Dix
 
Generative Artificial Intelligence (GenAI) in Business
Generative Artificial Intelligence (GenAI) in BusinessGenerative Artificial Intelligence (GenAI) in Business
Generative Artificial Intelligence (GenAI) in Business
Dr. Tathagat Varma
 
Build 3D Animated Safety Induction - Tech EHS
Build 3D Animated Safety Induction - Tech EHSBuild 3D Animated Safety Induction - Tech EHS
Build 3D Animated Safety Induction - Tech EHS
TECH EHS Solution
 
Transcript: #StandardsGoals for 2025: Standards & certification roundup - Tec...
Transcript: #StandardsGoals for 2025: Standards & certification roundup - Tec...Transcript: #StandardsGoals for 2025: Standards & certification roundup - Tec...
Transcript: #StandardsGoals for 2025: Standards & certification roundup - Tec...
BookNet Canada
 
The Evolution of Meme Coins A New Era for Digital Currency ppt.pdf
The Evolution of Meme Coins A New Era for Digital Currency ppt.pdfThe Evolution of Meme Coins A New Era for Digital Currency ppt.pdf
The Evolution of Meme Coins A New Era for Digital Currency ppt.pdf
Abi john
 
Special Meetup Edition - TDX Bengaluru Meetup #52.pptx
Special Meetup Edition - TDX Bengaluru Meetup #52.pptxSpecial Meetup Edition - TDX Bengaluru Meetup #52.pptx
Special Meetup Edition - TDX Bengaluru Meetup #52.pptx
shyamraj55
 
Are Cloud PBX Providers in India Reliable for Small Businesses (1).pdf
Are Cloud PBX Providers in India Reliable for Small Businesses (1).pdfAre Cloud PBX Providers in India Reliable for Small Businesses (1).pdf
Are Cloud PBX Providers in India Reliable for Small Businesses (1).pdf
Telecoms Supermarket
 
Unlocking the Power of IVR: A Comprehensive Guide
Unlocking the Power of IVR: A Comprehensive GuideUnlocking the Power of IVR: A Comprehensive Guide
Unlocking the Power of IVR: A Comprehensive Guide
vikasascentbpo
 
AI and Data Privacy in 2025: Global Trends
AI and Data Privacy in 2025: Global TrendsAI and Data Privacy in 2025: Global Trends
AI and Data Privacy in 2025: Global Trends
InData Labs
 
Massive Power Outage Hits Spain, Portugal, and France: Causes, Impact, and On...
Massive Power Outage Hits Spain, Portugal, and France: Causes, Impact, and On...Massive Power Outage Hits Spain, Portugal, and France: Causes, Impact, and On...
Massive Power Outage Hits Spain, Portugal, and France: Causes, Impact, and On...
Aqusag Technologies
 
Mastering Advance Window Functions in SQL.pdf
Mastering Advance Window Functions in SQL.pdfMastering Advance Window Functions in SQL.pdf
Mastering Advance Window Functions in SQL.pdf
Spiral Mantra
 
TrsLabs Consultants - DeFi, WEb3, Token Listing
TrsLabs Consultants - DeFi, WEb3, Token ListingTrsLabs Consultants - DeFi, WEb3, Token Listing
TrsLabs Consultants - DeFi, WEb3, Token Listing
Trs Labs
 
Noah Loul Shares 5 Steps to Implement AI Agents for Maximum Business Efficien...
Noah Loul Shares 5 Steps to Implement AI Agents for Maximum Business Efficien...Noah Loul Shares 5 Steps to Implement AI Agents for Maximum Business Efficien...
Noah Loul Shares 5 Steps to Implement AI Agents for Maximum Business Efficien...
Noah Loul
 
Splunk Security Update | Public Sector Summit Germany 2025
Splunk Security Update | Public Sector Summit Germany 2025Splunk Security Update | Public Sector Summit Germany 2025
Splunk Security Update | Public Sector Summit Germany 2025
Splunk
 
Rusty Waters: Elevating Lakehouses Beyond Spark
Rusty Waters: Elevating Lakehouses Beyond SparkRusty Waters: Elevating Lakehouses Beyond Spark
Rusty Waters: Elevating Lakehouses Beyond Spark
carlyakerly1
 
IEDM 2024 Tutorial2_Advances in CMOS Technologies and Future Directions for C...
IEDM 2024 Tutorial2_Advances in CMOS Technologies and Future Directions for C...IEDM 2024 Tutorial2_Advances in CMOS Technologies and Future Directions for C...
IEDM 2024 Tutorial2_Advances in CMOS Technologies and Future Directions for C...
organizerofv
 
Quantum Computing Quick Research Guide by Arthur Morgan
Quantum Computing Quick Research Guide by Arthur MorganQuantum Computing Quick Research Guide by Arthur Morgan
Quantum Computing Quick Research Guide by Arthur Morgan
Arthur Morgan
 
Web and Graphics Designing Training in Rajpura
Web and Graphics Designing Training in RajpuraWeb and Graphics Designing Training in Rajpura
Web and Graphics Designing Training in Rajpura
Erginous Technology
 
Semantic Cultivators : The Critical Future Role to Enable AI
Semantic Cultivators : The Critical Future Role to Enable AISemantic Cultivators : The Critical Future Role to Enable AI
Semantic Cultivators : The Critical Future Role to Enable AI
artmondano
 
TrsLabs - Fintech Product & Business Consulting
TrsLabs - Fintech Product & Business ConsultingTrsLabs - Fintech Product & Business Consulting
TrsLabs - Fintech Product & Business Consulting
Trs Labs
 
AI Changes Everything – Talk at Cardiff Metropolitan University, 29th April 2...
AI Changes Everything – Talk at Cardiff Metropolitan University, 29th April 2...AI Changes Everything – Talk at Cardiff Metropolitan University, 29th April 2...
AI Changes Everything – Talk at Cardiff Metropolitan University, 29th April 2...
Alan Dix
 
Generative Artificial Intelligence (GenAI) in Business
Generative Artificial Intelligence (GenAI) in BusinessGenerative Artificial Intelligence (GenAI) in Business
Generative Artificial Intelligence (GenAI) in Business
Dr. Tathagat Varma
 
Build 3D Animated Safety Induction - Tech EHS
Build 3D Animated Safety Induction - Tech EHSBuild 3D Animated Safety Induction - Tech EHS
Build 3D Animated Safety Induction - Tech EHS
TECH EHS Solution
 
Transcript: #StandardsGoals for 2025: Standards & certification roundup - Tec...
Transcript: #StandardsGoals for 2025: Standards & certification roundup - Tec...Transcript: #StandardsGoals for 2025: Standards & certification roundup - Tec...
Transcript: #StandardsGoals for 2025: Standards & certification roundup - Tec...
BookNet Canada
 
The Evolution of Meme Coins A New Era for Digital Currency ppt.pdf
The Evolution of Meme Coins A New Era for Digital Currency ppt.pdfThe Evolution of Meme Coins A New Era for Digital Currency ppt.pdf
The Evolution of Meme Coins A New Era for Digital Currency ppt.pdf
Abi john
 
Special Meetup Edition - TDX Bengaluru Meetup #52.pptx
Special Meetup Edition - TDX Bengaluru Meetup #52.pptxSpecial Meetup Edition - TDX Bengaluru Meetup #52.pptx
Special Meetup Edition - TDX Bengaluru Meetup #52.pptx
shyamraj55
 
Are Cloud PBX Providers in India Reliable for Small Businesses (1).pdf
Are Cloud PBX Providers in India Reliable for Small Businesses (1).pdfAre Cloud PBX Providers in India Reliable for Small Businesses (1).pdf
Are Cloud PBX Providers in India Reliable for Small Businesses (1).pdf
Telecoms Supermarket
 
Unlocking the Power of IVR: A Comprehensive Guide
Unlocking the Power of IVR: A Comprehensive GuideUnlocking the Power of IVR: A Comprehensive Guide
Unlocking the Power of IVR: A Comprehensive Guide
vikasascentbpo
 
AI and Data Privacy in 2025: Global Trends
AI and Data Privacy in 2025: Global TrendsAI and Data Privacy in 2025: Global Trends
AI and Data Privacy in 2025: Global Trends
InData Labs
 
Massive Power Outage Hits Spain, Portugal, and France: Causes, Impact, and On...
Massive Power Outage Hits Spain, Portugal, and France: Causes, Impact, and On...Massive Power Outage Hits Spain, Portugal, and France: Causes, Impact, and On...
Massive Power Outage Hits Spain, Portugal, and France: Causes, Impact, and On...
Aqusag Technologies
 
Mastering Advance Window Functions in SQL.pdf
Mastering Advance Window Functions in SQL.pdfMastering Advance Window Functions in SQL.pdf
Mastering Advance Window Functions in SQL.pdf
Spiral Mantra
 
TrsLabs Consultants - DeFi, WEb3, Token Listing
TrsLabs Consultants - DeFi, WEb3, Token ListingTrsLabs Consultants - DeFi, WEb3, Token Listing
TrsLabs Consultants - DeFi, WEb3, Token Listing
Trs Labs
 
Noah Loul Shares 5 Steps to Implement AI Agents for Maximum Business Efficien...
Noah Loul Shares 5 Steps to Implement AI Agents for Maximum Business Efficien...Noah Loul Shares 5 Steps to Implement AI Agents for Maximum Business Efficien...
Noah Loul Shares 5 Steps to Implement AI Agents for Maximum Business Efficien...
Noah Loul
 
Splunk Security Update | Public Sector Summit Germany 2025
Splunk Security Update | Public Sector Summit Germany 2025Splunk Security Update | Public Sector Summit Germany 2025
Splunk Security Update | Public Sector Summit Germany 2025
Splunk
 
Rusty Waters: Elevating Lakehouses Beyond Spark
Rusty Waters: Elevating Lakehouses Beyond SparkRusty Waters: Elevating Lakehouses Beyond Spark
Rusty Waters: Elevating Lakehouses Beyond Spark
carlyakerly1
 
IEDM 2024 Tutorial2_Advances in CMOS Technologies and Future Directions for C...
IEDM 2024 Tutorial2_Advances in CMOS Technologies and Future Directions for C...IEDM 2024 Tutorial2_Advances in CMOS Technologies and Future Directions for C...
IEDM 2024 Tutorial2_Advances in CMOS Technologies and Future Directions for C...
organizerofv
 
Quantum Computing Quick Research Guide by Arthur Morgan
Quantum Computing Quick Research Guide by Arthur MorganQuantum Computing Quick Research Guide by Arthur Morgan
Quantum Computing Quick Research Guide by Arthur Morgan
Arthur Morgan
 
Web and Graphics Designing Training in Rajpura
Web and Graphics Designing Training in RajpuraWeb and Graphics Designing Training in Rajpura
Web and Graphics Designing Training in Rajpura
Erginous Technology
 

SQL/MED: Doping for PostgreSQL

  • 1. SQL/MED Doping for PostgreSQL Peter Eisentraut Senior Software Engineer Lab Development F-Secure Corporation PGCon 2009
  • 2. SQL/MED: Management of External Data MED = Management of External Data Methods to access data stored outside the database system through normal SQL SQL/MED is ISO/IEC 9075-9
  • 3. Applications and Use Cases Connect to other DBMS (like DBI-Link) Other primary data storage: Oracle, MySQL, . . . Data warehouses etc.: Greenplum, Truviso, . . . Connect to other PostgreSQL instances (like dblink) Read non-SQL data Files: CSV, XML, JSON, . . . File systems: Google FS, Hadoop FS, Lustre, . . . Databases: CouchDB, BigTable, NDB, S3, . . . (“Cloud” stuff) Memcache Clustering, partitioning (think PL/Proxy) Manage data stored in file system Images Video Engineering data
  • 4. Applications and Use Cases Connect to other DBMS (like DBI-Link) Other primary data storage: Oracle, MySQL, . . . Data warehouses etc.: Greenplum, Truviso, . . . Connect to other PostgreSQL instances (like dblink) Read non-SQL data Files: CSV, XML, JSON, . . . File systems: Google FS, Hadoop FS, Lustre, . . . Databases: CouchDB, BigTable, NDB, S3, . . . (“Cloud” stuff) Memcache Clustering, partitioning (think PL/Proxy) Manage data stored in file system Images Video Engineering data
  • 5. Why do we care? Unifies existing ad-hoc solutions. Powerful new functionality Makes PostgreSQL the center of data management. Implementation has begun in PostgreSQL 8.4. Several people have plans for PostgreSQL 8.5. See status report later in this presentation.
  • 6. Advantages Schema integration All data appears as tables. Access control Use GRANT/REVOKE for everything. Standard APIs Mix and share. Centralized control Manage all data through the DBMS.
  • 7. Implications for Application Design and Deployment Before application application application application application MySQL MySQL PostgreSQL file system Oracle Cluster
  • 8. Implications for Application Design and Deployment After application application application application application PostgreSQL MySQL MySQL file system Oracle CouchDB Cluster
  • 9. The Two Parts of SQL/MED Wrapper interface Access other data sources, represent them as SQL tables Datalinks Manage files stored in file system, represent file references as column values
  • 10. Wrapper Interface Concepts Define a foreign table . . . On a foreign server . . . Accessed through a foreign-data wrapper
  • 11. Wrapper Interface Concepts Define a foreign table . . . think: a dblink view On a foreign server . . . think: dblink_connect Accessed through a foreign-data wrapper think: dblink.so library
  • 12. Foreign-Data Wrappers Foreign-data wrapper (FDW): a library that can communicate with external data sources CREATE FOREIGN DATA WRAPPER foosql LIBRARY 'foosql_fdw.so' LANGUAGE C; PostgreSQL communicates with foosql_fdw.so using SQL/MED FDW API. foosql_fdw.so communicates with FooSQL server using their own protocol. In theory, FooSQL, Inc. would ship foosql_fdw.so with their product. In practice, this is not so wide-spread.
  • 13. Foreign Servers Foreign server: an instance of an external data source accessed through a FDW CREATE SERVER extradb FOREIGN DATA WRAPPER foosql OPTIONS (host 'foo.example.com', port '2345'); Options depend on FDW.
  • 14. User Mappings User mapping: additional user-specific options for a foreign server CREATE USER MAPPING FOR peter SERVER extradb OPTIONS (user 'peter', password 'seKret'); Options depend on FDW. Putting connection options into server vs. user mapping is a matter of convention or convenience.
  • 15. Foreign Tables Foreign table: a table stored on a foreign server CREATE FOREIGN TABLE data SERVER extradb OPTIONS (tablename 'DATA123'); Now you can read and write the table as if it were local (depending on FDW features/implementation). Options specified for FDW, server, and user mapping are used as connection parameters (depending on FDW).
  • 16. Another Wrapper Interface Example Possible setup for accessing HTML tables stored in a web site as SQL tables: CREATE FOREIGN DATA WRAPPER htmlfile LIBRARY 'html_fdw.so' LANGUAGE C; CREATE SERVER intranetweb FOREIGN DATA WRAPPER htmlfile OPTIONS (baseurl 'http://intranet/data'); CREATE FOREIGN TABLE data SERVER intranetweb OPTIONS (path 'foo.html#//table[@id="table1"]');
  • 17. Routine Mappings Routine mappings: passing a function/procedure through to a foreign server CREATE ROUTINE MAPPING <routine mapping name> FOR <specific routine designator> SERVER <foreign server name> [ <generic options> ];
  • 18. Routine Mappings Examples Example like PL/Proxy: CREATE ROUTINE MAPPING myfunc(a int, b text) SERVER plproxydb OPTIONS (cluster 'somecluster', runon 'hashtext(a)'); Example XML-RPC: CREATE ROUTINE MAPPING process(data xml) SERVER xmlrpc OPTIONS (request '<methodCall>...</methodCall>');
  • 19. Wrapper Interface Access Control GRANT USAGE ON FOREIGN DATA WRAPPER GRANT USAGE FOREIGN SERVER Foreign tables and routines have regular privileges. Passwords for remote access can be managed via user mappings. Front-to-end Kerberos or SSL support could be cool.
  • 20. Importing Foreign Schemas Automatically create foreign tables based on tables available remotely. IMPORT FOREIGN SCHEMA someschema LIMIT TO (tab1, tab2, tab2) FROM SERVER extradb INTO myschema; (SQL standard doesn’t support foreign routine import.)
  • 21. Status of SQL/MED in PostgreSQL 8.4 PostgreSQL 8.4 has: CREATE FOREIGN DATA WRAPPER, but no library support CREATE SERVER CREATE USER MAPPING ACL support Doesn’t really do anything :-( Plans for PL/Proxy to store connection information
  • 22. Status of SQL/MED Elsewhere IBM DB2 provides a full implementation. MySQL and Farrago use some syntax elements. No other known implementations. Some vendors have had their custom remote access functionality.
  • 23. Plan & Issues PostgreSQL 8.5 and beyond . . . Write wrapper library and foreign table support Supply a few foreign-data wrapper libraries Use standard wrapper interface API or design our own API? Optimizations, e. g., passing query qualifications to foreign servers Distributed transactions Needs careful security evaluation (remember dblink issues)
  • 24. Plan & Issues PostgreSQL 8.5 and beyond . . . Write wrapper library and foreign table support Supply a few foreign-data wrapper libraries Use standard wrapper interface API or design our own API? Optimizations, e. g., passing query qualifications to foreign servers Distributed transactions Needs careful security evaluation (remember dblink issues)
  • 25. Datalink Concepts Files are referenced through a new DATALINK type Database system has control over external files No need to store file contents in database system Access control and integrity mechanisms of DBMS can be extended to file system
  • 26. Datalink Use Cases Certain types of data are primarily uses as files with external applications. Handling very large files (e. g., video) by DBMS is inefficient Use of distributed files systems Handle files stored on web server, FTP server, etc.
  • 27. Example: Simple DATALINK Type CREATE TABLE persons ( id integer, name text, picture DATALINK [NO LINK CONTROL] ); INSERT INTO persons VALUES ( 1, 'Jon Doe', DLVALUE('file://some/where/1.jpg') ); SQL specifies support for file: and http:. This variant doesn’t do anything except store URLs.
  • 28. DATALINK Attributes: Link and Integrity Control NO LINK CONTROL Datalink value need not reference an existing file/URL. FILE LINK CONTROL Datalink value must reference an existing file/URL. INTEGRITY ALL Referenced files can only be renamed or deleted through SQL. INTEGRITY SELECTIVE Referenced files can be renamed or deleted through SQL or directly. INTEGRITY NONE (implied for NO LINK CONTROL)
  • 29. DATALINK Attributes: Unlinking and Recovery Behavior ON UNLINK DELETE File is deleted from file system when deleted from database. ON UNLINK RESTORE File’s original permissions are restored when deleted from database. ON UNLINK NONE No change in file permissions when file reference is deleted from database. RECOVERY YES PITR applies to referenced files. RECOVERY NO PITR does not apply to referenced files.
  • 30. DATALINK Attributes: Access Permissions READ PERMISSION FS File system controls file read permission. READ PERMISSION DB Database system controls file read permission. WRITE PERMISSION FS File system controls file write permission. WRITE PERMISSION ADMIN Writes to the file are managed by the database system. WRITE PERMISSION BLOCKED Writing to file is blocked.
  • 31. How to Implement Datalinks Implementation challenges: OS-dependent File-system dependent Application-dependent Possibilities: Kernel modules LD_PRELOAD Extended FS attributes Lots of hocus pocus Don’t hold your breath.
  • 32. Summary SQL/MED Wrapper interface Datalinks Substantial support planned for PostgreSQL 8.5 and beyond Further reading: http://wiki.postgresql.org/wiki/SqlMedConnectionManager (Martin Pihlak) http://www.sigmod.org/record/issues/0103/JM-Sta.pdf (Jim Melton et al.) http://www.sigmod.org/record/issues/0209/jimmelton.pdf (Jim Melton et al.) ISO/IEC 9075-9:2008 (“SQL/MED”)
  • 33. Rights and Attributions This presentation “SQL/MED: Doping for PostgreSQL” was authored by Peter Eisentraut and is licensed under the Creative Commons Attribution-Noncommercial-Share Alike 3.0 Unported license. The image on page 2 is from the Open Clip Art Library and is in the public domain. The image on page 5 is from the Open Clip Art Library and is in the public domain. The image on page 9 is “The fork in the road” by Flickr user i_yudai, available under the Creative Commons Attribution 2.0 Generic license. The image on page 31 is “Fork in a Steve” by Flickr user morgantepsic, available under the Creative Commons Attribution-Share Alike 2.0 Generic license.