SlideShare ist ein Scribd-Unternehmen logo
1 von 33
Downloaden Sie, um offline zu lesen
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.

Weitere ähnliche Inhalte

Was ist angesagt?

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 converterDeepti Singh
 
File character set converter
File character set converterFile character set converter
File character set converterDeepti Singh
 
Persitance Data with sqlite
Persitance Data with sqlitePersitance Data with sqlite
Persitance Data with sqliteArif Huda
 
Information Retrieval - Data Science Bootcamp
Information Retrieval - Data Science BootcampInformation Retrieval - Data Science Bootcamp
Information Retrieval - Data Science BootcampKais Hassan, PhD
 
[Android] Data Storage
[Android] Data Storage[Android] Data Storage
[Android] Data StorageNikmesoft 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: Overvieweuc-dm-test
 
DbVisualizer for NonStop SQL
DbVisualizer for NonStop SQLDbVisualizer for NonStop SQL
DbVisualizer for NonStop SQLFrans 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 SolrBiogeeks
 
Android datastorage
Android datastorageAndroid datastorage
Android datastorageKrazy 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 WebserverFrans Jongma
 
MySQL 8 Server Optimization Swanseacon 2018
MySQL 8 Server Optimization Swanseacon 2018MySQL 8 Server Optimization Swanseacon 2018
MySQL 8 Server Optimization Swanseacon 2018Dave 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 analyticsTiziano Fagni
 
Intro to T-SQL – 2nd session
Intro to T-SQL – 2nd sessionIntro to T-SQL – 2nd session
Intro to T-SQL – 2nd sessionMedhat Dawoud
 
Sqlite
SqliteSqlite
SqliteKumar
 
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 thereMarco Gralike
 

Was ist angesagt? (20)

Introduction to oracle(2)
Introduction to oracle(2)Introduction to oracle(2)
Introduction to oracle(2)
 
Introduction to oracle
Introduction to oracleIntroduction to oracle
Introduction to oracle
 
Sql lite android
Sql lite androidSql lite android
Sql lite android
 
File character set converter
File character set converterFile character set converter
File character set converter
 
File character set converter
File character set converterFile character set converter
File character set converter
 
Persitance Data with sqlite
Persitance Data with sqlitePersitance Data with sqlite
Persitance Data with sqlite
 
Information Retrieval - Data Science Bootcamp
Information Retrieval - Data Science BootcampInformation Retrieval - Data Science Bootcamp
Information Retrieval - Data Science Bootcamp
 
[Android] Data Storage
[Android] Data Storage[Android] Data Storage
[Android] Data Storage
 
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...
 
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
 
DbVisualizer for NonStop SQL
DbVisualizer for NonStop SQLDbVisualizer for NonStop SQL
DbVisualizer for NonStop SQL
 
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
 
Android datastorage
Android datastorageAndroid datastorage
Android datastorage
 
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
 
MySQL 8 Server Optimization Swanseacon 2018
MySQL 8 Server Optimization Swanseacon 2018MySQL 8 Server Optimization Swanseacon 2018
MySQL 8 Server Optimization Swanseacon 2018
 
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
 
Intro to T-SQL – 2nd session
Intro to T-SQL – 2nd sessionIntro to T-SQL – 2nd session
Intro to T-SQL – 2nd session
 
Sqlite
SqliteSqlite
Sqlite
 
Apache solr
Apache solrApache solr
Apache solr
 
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
 

Ähnlich wie SQL/MED: Doping for PostgreSQL

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 PostgresEDB
 
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 DaroldEqunix 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 & IkeIke Ellis
 
Introduction to firebidSQL 3.x
Introduction to firebidSQL 3.xIntroduction to firebidSQL 3.x
Introduction to firebidSQL 3.xFabio 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-fromPlantoBackuptoCloudTobias 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.pptxLadduAnanu
 
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 AnythingDenodo
 
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 DiveTravis 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 platformMostafa
 
New VMware Continuent 5.0 - A powerful and cost-efficient Oracle GoldenGate a...
New VMware Continuent 5.0 - A powerful and cost-efficient Oracle GoldenGate a...New VMware Continuent 5.0 - A powerful and cost-efficient Oracle GoldenGate a...
New VMware Continuent 5.0 - A powerful and cost-efficient Oracle GoldenGate a...Continuent
 

Ähnlich wie SQL/MED: Doping for PostgreSQL (20)

Quantopix analytics system (qas)
Quantopix analytics system (qas)Quantopix analytics system (qas)
Quantopix analytics system (qas)
 
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
 
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
 
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
 
Sql azure dec_2010 Lynn & Ike
Sql azure dec_2010 Lynn & IkeSql azure dec_2010 Lynn & Ike
Sql azure dec_2010 Lynn & Ike
 
Introduction to firebidSQL 3.x
Introduction to firebidSQL 3.xIntroduction to firebidSQL 3.x
Introduction to firebidSQL 3.x
 
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...
 
KoprowskiT_SQLSat230_Rheinland_SQLAzure-fromPlantoBackuptoCloud
KoprowskiT_SQLSat230_Rheinland_SQLAzure-fromPlantoBackuptoCloudKoprowskiT_SQLSat230_Rheinland_SQLAzure-fromPlantoBackuptoCloud
KoprowskiT_SQLSat230_Rheinland_SQLAzure-fromPlantoBackuptoCloud
 
Hadoop_arunam_ppt
Hadoop_arunam_pptHadoop_arunam_ppt
Hadoop_arunam_ppt
 
HadoopDB
HadoopDBHadoopDB
HadoopDB
 
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
 
Obevo Javasig.pptx
Obevo Javasig.pptxObevo Javasig.pptx
Obevo Javasig.pptx
 
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
 
MS-SQL SERVER ARCHITECTURE
MS-SQL SERVER ARCHITECTUREMS-SQL SERVER ARCHITECTURE
MS-SQL SERVER ARCHITECTURE
 
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
 
Sql server basics
Sql server basicsSql server basics
Sql server basics
 
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...
 
Azure Data platform
Azure Data platformAzure Data platform
Azure Data platform
 
PHP Oracle
PHP OraclePHP Oracle
PHP Oracle
 
New VMware Continuent 5.0 - A powerful and cost-efficient Oracle GoldenGate a...
New VMware Continuent 5.0 - A powerful and cost-efficient Oracle GoldenGate a...New VMware Continuent 5.0 - A powerful and cost-efficient Oracle GoldenGate a...
New VMware Continuent 5.0 - A powerful and cost-efficient Oracle GoldenGate a...
 

Mehr von Peter Eisentraut

Programming with Python and PostgreSQL
Programming with Python and PostgreSQLProgramming with Python and PostgreSQL
Programming with Python and PostgreSQLPeter Eisentraut
 
Getting Started with PL/Proxy
Getting Started with PL/ProxyGetting Started with PL/Proxy
Getting Started with PL/ProxyPeter Eisentraut
 
Linux distribution for the cloud
Linux distribution for the cloudLinux distribution for the cloud
Linux distribution for the cloudPeter Eisentraut
 
Porting Applications From Oracle To PostgreSQL
Porting Applications From Oracle To PostgreSQLPorting Applications From Oracle To PostgreSQL
Porting Applications From Oracle To PostgreSQLPeter Eisentraut
 
Porting Oracle Applications to PostgreSQL
Porting Oracle Applications to PostgreSQLPorting Oracle Applications to PostgreSQL
Porting Oracle Applications to PostgreSQLPeter Eisentraut
 
XML Support: Specifications and Development
XML Support: Specifications and DevelopmentXML Support: Specifications and Development
XML Support: Specifications and DevelopmentPeter Eisentraut
 
PostgreSQL: Die Freie Datenbankalternative
PostgreSQL: Die Freie DatenbankalternativePostgreSQL: Die Freie Datenbankalternative
PostgreSQL: Die Freie DatenbankalternativePeter 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 DevelopmentsPeter Eisentraut
 
Access ohne Access: Freie Datenbank-Frontends
Access ohne Access: Freie Datenbank-FrontendsAccess ohne Access: Freie Datenbank-Frontends
Access ohne Access: Freie Datenbank-FrontendsPeter Eisentraut
 
Replication Solutions for PostgreSQL
Replication Solutions for PostgreSQLReplication Solutions for PostgreSQL
Replication Solutions for PostgreSQLPeter Eisentraut
 
Access ohne Access: Freie Datenbank-Frontends
Access ohne Access: Freie Datenbank-FrontendsAccess ohne Access: Freie Datenbank-Frontends
Access ohne Access: Freie Datenbank-FrontendsPeter Eisentraut
 
Docbook: Textverarbeitung mit XML
Docbook: Textverarbeitung mit XMLDocbook: Textverarbeitung mit XML
Docbook: Textverarbeitung mit XMLPeter 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
 

Mehr von Peter Eisentraut (20)

Programming with Python and PostgreSQL
Programming with Python and PostgreSQLProgramming with Python and PostgreSQL
Programming with Python and PostgreSQL
 
Getting Started with PL/Proxy
Getting Started with PL/ProxyGetting Started with PL/Proxy
Getting Started with PL/Proxy
 
Linux distribution for the cloud
Linux distribution for the cloudLinux distribution for the cloud
Linux distribution for the cloud
 
Porting Applications From Oracle To PostgreSQL
Porting Applications From Oracle To PostgreSQLPorting Applications From Oracle To PostgreSQL
Porting Applications From Oracle To PostgreSQL
 
Porting Oracle Applications to PostgreSQL
Porting Oracle Applications to PostgreSQLPorting Oracle Applications to PostgreSQL
Porting Oracle Applications to PostgreSQL
 
PostgreSQL and XML
PostgreSQL and XMLPostgreSQL and XML
PostgreSQL and XML
 
XML Support: Specifications and Development
XML Support: Specifications and DevelopmentXML Support: Specifications and Development
XML Support: Specifications and Development
 
PostgreSQL: Die Freie Datenbankalternative
PostgreSQL: Die Freie DatenbankalternativePostgreSQL: Die Freie Datenbankalternative
PostgreSQL: Die Freie Datenbankalternative
 
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
 
Access ohne Access: Freie Datenbank-Frontends
Access ohne Access: Freie Datenbank-FrontendsAccess ohne Access: Freie Datenbank-Frontends
Access ohne Access: Freie Datenbank-Frontends
 
PostgreSQL and PL/Java
PostgreSQL and PL/JavaPostgreSQL and PL/Java
PostgreSQL and PL/Java
 
Replication Solutions for PostgreSQL
Replication Solutions for PostgreSQLReplication Solutions for PostgreSQL
Replication Solutions for PostgreSQL
 
PostgreSQL News
PostgreSQL NewsPostgreSQL News
PostgreSQL News
 
PostgreSQL News
PostgreSQL NewsPostgreSQL News
PostgreSQL News
 
Access ohne Access: Freie Datenbank-Frontends
Access ohne Access: Freie Datenbank-FrontendsAccess ohne Access: Freie Datenbank-Frontends
Access ohne Access: Freie Datenbank-Frontends
 
Docbook: Textverarbeitung mit XML
Docbook: Textverarbeitung mit XMLDocbook: Textverarbeitung mit XML
Docbook: Textverarbeitung mit XML
 
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...
 
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...
 
Spaß mit PostgreSQL
Spaß mit PostgreSQLSpaß mit PostgreSQL
Spaß mit PostgreSQL
 
The Common Debian Build System (CDBS)
The Common Debian Build System (CDBS)The Common Debian Build System (CDBS)
The Common Debian Build System (CDBS)
 

Kürzlich hochgeladen

Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptx
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptxPasskey Providers and Enabling Portability: FIDO Paris Seminar.pptx
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptxLoriGlavin3
 
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptxThe Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptxLoriGlavin3
 
A Deep Dive on Passkeys: FIDO Paris Seminar.pptx
A Deep Dive on Passkeys: FIDO Paris Seminar.pptxA Deep Dive on Passkeys: FIDO Paris Seminar.pptx
A Deep Dive on Passkeys: FIDO Paris Seminar.pptxLoriGlavin3
 
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
 
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptxUse of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptxLoriGlavin3
 
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
 
"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii SoldatenkoFwdays
 
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
 
The State of Passkeys with FIDO Alliance.pptx
The State of Passkeys with FIDO Alliance.pptxThe State of Passkeys with FIDO Alliance.pptx
The State of Passkeys with FIDO Alliance.pptxLoriGlavin3
 
Take control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test SuiteTake control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test SuiteDianaGray10
 
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptxMerck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptxLoriGlavin3
 
Gen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfGen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfAddepto
 
From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .Alan Dix
 
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
 
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
 
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024BookNet Canada
 
Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 3652toLead Limited
 
What is DBT - The Ultimate Data Build Tool.pdf
What is DBT - The Ultimate Data Build Tool.pdfWhat is DBT - The Ultimate Data Build Tool.pdf
What is DBT - The Ultimate Data Build Tool.pdfMounikaPolabathina
 
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc
 
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdf
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdfHyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdf
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdfPrecisely
 

Kürzlich hochgeladen (20)

Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptx
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptxPasskey Providers and Enabling Portability: FIDO Paris Seminar.pptx
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptx
 
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptxThe Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
 
A Deep Dive on Passkeys: FIDO Paris Seminar.pptx
A Deep Dive on Passkeys: FIDO Paris Seminar.pptxA Deep Dive on Passkeys: FIDO Paris Seminar.pptx
A Deep Dive on Passkeys: FIDO Paris Seminar.pptx
 
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?
 
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptxUse of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
 
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
 
"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko
 
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
 
The State of Passkeys with FIDO Alliance.pptx
The State of Passkeys with FIDO Alliance.pptxThe State of Passkeys with FIDO Alliance.pptx
The State of Passkeys with FIDO Alliance.pptx
 
Take control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test SuiteTake control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test Suite
 
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptxMerck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptx
 
Gen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfGen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdf
 
From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .
 
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
 
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
 
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
 
Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365
 
What is DBT - The Ultimate Data Build Tool.pdf
What is DBT - The Ultimate Data Build Tool.pdfWhat is DBT - The Ultimate Data Build Tool.pdf
What is DBT - The Ultimate Data Build Tool.pdf
 
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
 
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdf
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdfHyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdf
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdf
 

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.