Re: [HACKERS] Most efficient way for libPQ .. PGresult serialization

2016-08-22 Thread Joshua Bay
Oh I see. I just read more on use cases PgBouncer, but seems like it can't be used for my project. The reason is that I need to have my middleware to have full control over each transaction. That is it must be able to decide if it's going to commit or abort a single query (reason why libpq is used

Re: [HACKERS] Most efficient way for libPQ .. PGresult serialization

2016-08-22 Thread Joshua Bay
No, it can be anything else. Please correctly me if I'm wrong, but to me, PgPool-II looks like a proxy server that forwards all the data without interpretation. Can I intercept in the middle and control the flow between client and server? For e.g, I need control when the result of transaction is

Re: [HACKERS] Most efficient way for libPQ .. PGresult serialization

2016-08-20 Thread Craig Ringer
On 19 August 2016 at 22:16, Joshua Bay wrote: > Oh I see. > I just read more on use cases PgBouncer, but seems like it can't be used > for my project. > The reason is that I need to have my middleware to have full control over > each transaction. > That is it must be able

Re: [HACKERS] Most efficient way for libPQ .. PGresult serialization

2016-08-18 Thread Craig Ringer
On 19 August 2016 at 03:08, Joshua Bay wrote: > Thanks, > But I don't think my question was clear enough. > > I already managed the connection pooling, and what I need is to serialize > the result. > > If PGresult was a contiguous block, I could have just create buffer and

Re: [HACKERS] Most efficient way for libPQ .. PGresult serialization

2016-08-18 Thread Joshua Bay
Thanks, But I don't think my question was clear enough. I already managed the connection pooling, and what I need is to serialize the result. If PGresult was a contiguous block, I could have just create buffer and call memcpy for serialization, but structure of result seems much more

Re: [HACKERS] Most efficient way for libPQ .. PGresult serialization

2016-08-17 Thread Tatsuo Ishii
> On 18 August 2016 at 10:05, Joshua Bay wrote: > >> Hi, >> >> I was trying to implement a middleware that lies between client and >> postgres. >> >> So, this middleware is supposed to run query with libpq, do its job on >> them, and then serialize the result of query, and

Re: [HACKERS] Most efficient way for libPQ .. PGresult serialization

2016-08-17 Thread Craig Ringer
On 18 August 2016 at 10:05, Joshua Bay wrote: > Hi, > > I was trying to implement a middleware that lies between client and > postgres. > > So, this middleware is supposed to run query with libpq, do its job on > them, and then serialize the result of query, and send it to

[HACKERS] Most efficient way for libPQ .. PGresult serialization

2016-08-17 Thread Joshua Bay
Hi, I was trying to implement a middleware that lies between client and postgres. So, this middleware is supposed to run query with libpq, do its job on them, and then serialize the result of query, and send it to the client ! (client deserializes to PGresult) I could simply iterate over rows