brianc / node-postgres

PostgreSQL client for node.js.
https://node-postgres.com
MIT License
12.33k stars 1.23k forks source link

Question: What is the best way to have node-pg wait in a queue? #769

Closed JemiloII closed 9 years ago

JemiloII commented 9 years ago

So I'm using node-pg to run queries, however the database I'm using will have a queue. It seems that when it becomes my turn, node-pg doesn't know, and I get passed on, leaving the app to hang.

brianc commented 9 years ago

I'm not sure what you mean by the database having a queue. Are you using some 3rd party queuing technology between your app and postgres?

On Fri, Apr 24, 2015 at 12:11 PM, Brian M. Jemilo II < notifications@github.com> wrote:

So I'm using node-pg to run queries, however the database I'm using will have a queue. It seems that when it becomes my turn, node-pg doesn't know, and I get passed on, leaving the app to hang.

— Reply to this email directly or view it on GitHub https://github.com/brianc/node-postgres/issues/769.

JemiloII commented 9 years ago

Yeah, it's a greenplum db that uses postgres for the driver. Essentially, there is a max concurrent queue limit. Everyone else just has to wait.

brianc commented 9 years ago

If greenplumb isn't using the standard postgres protocol (which I'm guessing its not because it has to signal a 'wait' somehow) then its not gonna work with node-postgres unfortunately. Custom protocol signaling is not supported. Do you know the internals of how the greenplum protocol works at all?

On Fri, Apr 24, 2015 at 1:00 PM, Brian M. Jemilo II < notifications@github.com> wrote:

Yeah, it's a greenplum db that uses postgres for the driver. Essentially, there is a max concurrent queue limit. Everyone else just has to wait.

— Reply to this email directly or view it on GitHub https://github.com/brianc/node-postgres/issues/769#issuecomment-95992460 .

JemiloII commented 9 years ago

I just know that it uses postgresql 8.2, the node-pg works fine as long as there isn't many users. What internal information do you need, and I'll try and get them.

brianc commented 9 years ago

Unfortunately, if it's not an actual postgres (or redshift) database then I'm not really in the business of supporting it. However, open source is great cause we can all build on what each of us does, so if you want to dig in and see if you can figure out where things are going wrong I'm happy to point you in the right direction. Firstly you'd probably need to figure out if it implements the entire postgres protocol and doesn't extend it in any way. To find that out I'd dig into the docs for the source system or code if its open source.

On Fri, Apr 24, 2015 at 2:06 PM, Brian M. Jemilo II < notifications@github.com> wrote:

I just know that it uses postgresql 8.2, the node-pg works fine as long as there isn't many users. What internal information do you need, and I'll try and get them.

— Reply to this email directly or view it on GitHub https://github.com/brianc/node-postgres/issues/769#issuecomment-96016836 .