More PostgreSQL+CORBA - Mailing list pgsql-hackers

From Michael Robinson
Subject More PostgreSQL+CORBA
Date
Msg-id 199811131719.BAA26341@public.bta.net.cn
Whole thread Raw
Responses Re: [HACKERS] More PostgreSQL+CORBA  (The Hermit Hacker <scrappy@hub.org>)
Re: [HACKERS] More PostgreSQL+CORBA  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-hackers
CORBA in fifty words or less:    CORBA is an architecture which specifies how to:    - define the method signatures of
anobject type    - obtain a reference to a object instance    - invoke a method, with parameters, on an object instance
  - receive the results    - all interoperably between different programming languages, object      implementations,
andplatforms.  
 
Why CORBA?     If you don't do object-oriented programming and system design, the   rationale for CORBA will be hard to
understand. If you don't understand   why PostgreSQL is called an "object-relational" database (and why every   row has
anOID), the rationale for PostgreSQL+CORBA will be hard to   understand.     The short version goes like this:
Thinkof a database table as a "typedef" of a data structure, with each   row representing a malloc'ed instance of that
structuretype.  The   database provides for persistant storage, and concurrent data access,   but with a considerable
accessoverhead: sending an SQL query string down   a socket, parsing the query string into an execution plan, executing
 the plan, coverting the returned result set into text strings, sending   the strings down a socket, retrieving the
stringsfrom the socket, and,   finally, converting the text strings back into usable data values.     With CORBA,
though,you could keep a reference (OID, pointer, etc.) to   each data structure of interest, and just call a function
toread or    write data to fields in that structure.  Another way to think of it    is cursors without queries.  The
database(PostgreSQL in our case)   continues to maintain persistence and concurrent access, and the data   is also
alwaysavailable for relational queries.   
 
Which ORB?   GNOME started with Mico.  Mico, apparently, makes use of C++ templates,    which caused the compiler they
wereusing to generate bloated, wallowing    code.      GNOME then adopted ORBit, which has two wins: it's in C, and
(thisis   the biggy) it has provisions to shortcut parameter marshalling,   transmission, authentication, reception,
anddemarshalling--if the client   stub and server skeleton are in the same address space, and both stub   and skeleton
permitthis.
 
   This means that, with ORBit, CORBA method calls can be almost as   efficient as normal function calls.

How to use CORBA with PostgreSQL?
   There are three ways I can see this working:
   1. As a simple alternative for the current FE<->BE communication protocol.      The SQL query engine continues to
intermediateall transactions.  This      has some benefits, but is really boring to me.
 
   2. As an alternative to both the FE<->BE communication protocol and the      SQL query engine.  In this case,
programscould have efficient direct      row access, but all data transfers would still be shoved through a      socket
(viathe Internet Inter-Orb Protocol).  This could be useful,      and mildly interesting.
 
   3. As an alternative API to libpq that would allow, for example,      embedding a Python interpreter in the backend,
withPostgreSQL tables      exposed through CORBA as native Python classes, and with high      performance via ORBit
methodshortcutting.  This, in my opinion,      would be the most useful and interesting.
 

    -Michael Robinson



pgsql-hackers by date:

Previous
From: Bruce Momjian
Date:
Subject: Re: [HACKERS] High-level of inserts makes database drop core
Next
From: The Hermit Hacker
Date:
Subject: Re: [HACKERS] More PostgreSQL+CORBA