Re: question about HTTP API - Mailing list pgsql-hackers

From Greg Stark
Subject Re: question about HTTP API
Date
Msg-id CAM-w4HNzH_Yh-YUm+3VanDtkT3Uf8VcvQCkKBkMd5Q3Bwu_FmQ@mail.gmail.com
Whole thread Raw
In response to Re: question about HTTP API  (Andrew Tipton <andrew@kiwidrew.com>)
Responses Re: question about HTTP API
List pgsql-hackers
On Fri, Aug 9, 2013 at 9:21 AM, Andrew Tipton <andrew@kiwidrew.com> wrote:
I recently threw together a quick-and-dirty prototype of this idea.  It was an external tool which used the libmicrohttpd library to accept incoming requests, convert them to a SQL query (which called a stored procedure), and return the query results.  (It allowed *any* content-type to be returned, not just JSON.)  I only got as far as handling GET requests.  The code is available here:

I looked at the wiki and thought it had a lot of good ideas but also a lot of good questions. do you have any idea how to tackle the session problem?

Postgres has always assumed session == backend == connection. TPC prepared transactions are the one main break in this model and they can take a lot of short cuts because they know there will be no more operations in the transaction aside from commit or rollback.

A decent HTTP RPC layer will need to have some way of creating a session and issuing multiple requests on that session. That session will need to be a stored and available for future requests. The obvious concern is state like the current database, current role, gucs, and prepared queries. But even if you're prepared to discard those for a stateless interface the performance issues of not having a relcache built will be pretty severe.

I suspect this is something better built into something like pgbouncer which already has to deal with multiplexing many clients onto a single connection.


--
greg

pgsql-hackers by date:

Previous
From: Andrew Tipton
Date:
Subject: Re: question about HTTP API
Next
From: Andrew Tipton
Date:
Subject: Re: question about HTTP API