Re: [GENERAL] Too much clients connected to the PostgreSQL Database

2012-10-29 Thread Kevin Grittner
rodr...@paripassu.com.br wrote: > 150 maxActive setting, but we have some low usage application > getting direct db connection(out of the pool). You will probably be better off with a connection pool somewhere between 10 and 20, as long as it is transaction-based, the client side has low latency

Re: [GENERAL] Access to postgresql query optimizer output

2012-10-29 Thread Craig Ringer
On 10/30/2012 12:33 AM, Peter Geoghegan wrote: > On 29 October 2012 16:00, Jeff Janes wrote: >> The re-writing does not occur at the level of SQL, but rather at the >> level of an internal representation "parse tree". > > Right. The post parse-analysis tree (i.e. the Query struct) is > potentiall

Re: [GENERAL] Too much clients connected to the PostgreSQL Database

2012-10-29 Thread Xiong He
If you are using connection pool, did you use pgbouncer to reduce the maximum physical connection? You said, "but we have some low usage application getting direct db connection(out of the pool)." It will mean that some connections are not controlled by the connection pool. This can be variab

Re: [GENERAL] Too much clients connected to the PostgreSQL Database

2012-10-29 Thread rodrigo
150 maxActive setting, but we have some low usage application getting direct db connection(out of the pool). The interesting is that the server suddently get a lot of connections and reach the limit and then release them. I'm willing to change to Tomcat 7 connection pool. We are using c3pO and a

Re: [GENERAL] How to print application_name in log_line_prefix (using %a)?

2012-10-29 Thread Adrian Klaver
On 10/29/2012 11:03 AM, Tianyin Xu wrote: I see. Then it should not be included in postgresql.conf, since that makes no sense for setting it. How do you figure? AFAIK if you set it then it will be a default for all non-background connections. In the event a connection specifies a applicatio

Re: [GENERAL] Too much clients connected to the PostgreSQL Database

2012-10-29 Thread Kevin Grittner
Rodrigo Pereira da Silva wrote: > We have about 10 web applications deployed in a Tomcat 7.0 > accessing a Postgresql 9.1 database. We do use connection pooling. > We have the max_connections parameter set to 200 connections, > however, we are reaching the max connections sporadically(about 4 >

[GENERAL] Too much clients connected to the PostgreSQL Database

2012-10-29 Thread Rodrigo Pereira da Silva
Hi Guys,         We have about 10 web applications deployed in a Tomcat 7.0 accessing a Postgresql 9.1 database. We do use connection pooling.     We have the max_connections parameter set to 200 connections, however, we are reaching the max

[GENERAL] pg_archivecleanup - clean up files with extensions

2012-10-29 Thread hartrc
I'm running postgresql9.1.6 I would like to run pg_archivecleanup on wal files that have a .gz extension. I notice in the version 9.2 documentation there is an option for this. Is there an easy way to achieve the same thing in 9.1? Thanks, Rob -- View this message in context: http://postgres

Re: [GENERAL] How to print application_name in log_line_prefix (using %a)?

2012-10-29 Thread Tianyin Xu
I see. Then it should not be included in postgresql.conf, since that makes no sense for setting it. @Chris, it is in the docs, see the following PG-9.2 manual page: http://www.postgresql.org/docs/9.2/interactive/runtime-config-logging.html#GUC-APPLICATION-NAME T On Mon, Oct 29, 2012 at 8:58 AM

Re: [GENERAL] Access to postgresql query optimizer output

2012-10-29 Thread Peter Geoghegan
On 29 October 2012 16:00, Jeff Janes wrote: > The re-writing does not occur at the level of SQL, but rather at the > level of an internal representation "parse tree". Right. The post parse-analysis tree (i.e. the Query struct) is potentially rewritten by an explicit rewrite stage after parse-anal

Re: [GENERAL] Access to postgresql query optimizer output

2012-10-29 Thread Tom Lane
Jeff Janes writes: > On Mon, Oct 29, 2012 at 1:07 AM, Seref Arikan > wrote: >> I keep seeing statements like "Postgresql optimizer rewrites this query >> as" What I'm curious about is, is there a way to obtain SQL form of the >> re-written queries somewhere in the chain of query evaluation? I

Re: [GENERAL] Why BgWriterDelay is fixed?

2012-10-29 Thread Tom Lane
Jeff Janes writes: > The value hard coded into the C code is the starting value, or > default. It is not a constant. > Indeed, I don't think that value is even used. I think that upon > start-up, that value gets set to the default listed in the guc.c file > (which is also 200), and so the value

Re: [GENERAL] Why BgWriterDelay is fixed?

2012-10-29 Thread Peter Geoghegan
On 29 October 2012 07:17, 高健 wrote: > But I also found the following in postgresql.conf: > #bgwriter_delay = 200ms # 10-1ms between rounds > It is now comment . > But according to the fixed code of BgWriterDelay = 200, even when I update > bgwriter_delay in postgresql.conf to

Re: [GENERAL] How to print application_name in log_line_prefix (using %a)?

2012-10-29 Thread Jeff Janes
On Mon, Oct 29, 2012 at 8:58 AM, Tom Lane wrote: > Chris Angelico writes: >> On Mon, Oct 29, 2012 at 5:44 PM, Tianyin Xu wrote: >>> I still wonder why application_name appears in the configuration file if it >>> cannot take effort :-P > >> Not sure what you mean by that, but my postgresql.conf d

Re: [GENERAL] Access to postgresql query optimizer output

2012-10-29 Thread Jeff Janes
On Mon, Oct 29, 2012 at 1:07 AM, Seref Arikan wrote: > Greetings, > I keep seeing statements like "Postgresql optimizer rewrites this query > as" What I'm curious about is, is there a way to obtain SQL form of the > re-written queries somewhere in the chain of query evaluation? It does not > m

Re: [GENERAL] How to print application_name in log_line_prefix (using %a)?

2012-10-29 Thread Tom Lane
Chris Angelico writes: > On Mon, Oct 29, 2012 at 5:44 PM, Tianyin Xu wrote: >> I still wonder why application_name appears in the configuration file if it >> cannot take effort :-P > Not sure what you mean by that, but my postgresql.conf doesn't have > anything about application_name. But if it

Re: [GENERAL] Why BgWriterDelay is fixed?

2012-10-29 Thread Jeff Janes
On Mon, Oct 29, 2012 at 12:17 AM, 高健 wrote: > In src/backend/postmaster/bgwriter.c , I can find the following source > code(PostgreSQL9.2): > > > /* > * GUC parameters > */ > int BgWriterDelay = 200; The value hard coded into the C code is the starting value, or default. It is not a constant.

Re: [GENERAL] How to print application_name in log_line_prefix (using %a)?

2012-10-29 Thread Chris Angelico
On Tue, Oct 30, 2012 at 12:53 AM, Adrian Klaver wrote: > On 10/29/2012 04:00 AM, Chris Angelico wrote: >> >> Not sure what you mean by that, but my postgresql.conf doesn't have >> anything about application_name. But if it did, it would be a default >> that an application can override. > > > Actua

Re: [GENERAL] How to print application_name in log_line_prefix (using %a)?

2012-10-29 Thread Adrian Klaver
On 10/29/2012 04:00 AM, Chris Angelico wrote: On Mon, Oct 29, 2012 at 5:44 PM, Tianyin Xu wrote: Got it! Thanks, Chris! I still wonder why application_name appears in the configuration file if it cannot take effort :-P Not sure what you mean by that, but my postgresql.conf doesn't have anyth

Re: [GENERAL] oracle_fdw with oracle os authentication

2012-10-29 Thread Albe Laurenz
[added CC to oracle-fdw-general, where this should be] Papiernik Anna-AAP053 wrote: > I have Oracle with OS authentication. > > And I have installed PostgreSQL and I want to migrate data from Oracle to PostgreSQL database. > > > > I have performed steps: > > CREATE EXTENSION oracle_fdw; > >

Re: [GENERAL] SPI_prepare's parameter

2012-10-29 Thread Albe Laurenz
高健 wrote: > I am new to PostgreSQL's SPI(Server Programming Interface). > > I can understand PostgreSQL's exampel of using SPI. But I am not sure about > SPI_prepare's parameter. > > void * SPI_prepare(const char * command, int nargs, Oid * argtypes) > > > Can somebody kindly give an example o

Re: [GENERAL] How to print application_name in log_line_prefix (using %a)?

2012-10-29 Thread Chris Angelico
On Mon, Oct 29, 2012 at 5:44 PM, Tianyin Xu wrote: > Got it! Thanks, Chris! > > I still wonder why application_name appears in the configuration file if it > cannot take effort :-P Not sure what you mean by that, but my postgresql.conf doesn't have anything about application_name. But if it did,

[GENERAL] Streaming replication with different structure

2012-10-29 Thread salah jubeh
Greetings, I have a binary replication as follow: 1. The primary is used for the write operation 2. I am interested in optimizing a query of one of the tables which has a daily partitions with around 8 GB in size. 3. The server is used mainly for write and the average data write for all tables

Re: [GENERAL] table logging

2012-10-29 Thread Richard Huxton
On 28/10/12 19:25, Jeff Janes wrote: I am looking for some very simple table logging. I am not trying to do auditing in a hostile environment, just simple logging. I found two candidates, tablelog from pgfoundry, and http://wiki.postgresql.org/wiki/Audit_trigger_91plus The first has the advant

Re: [GENERAL] Why BgWriterDelay is fixed?

2012-10-29 Thread Xiong He
You can check the code in guc.c,  search "bgwriter_delay",  &BgWriterDelayIn the global user configuration, it can change the value of BgWriterDelay.Since the BgWriterDelay declared in bgwriter.h as extern.  It can be changed in the global namespace.--Thanks&Regards,Xiong He ---

Re: [GENERAL] Access to postgresql query optimizer output

2012-10-29 Thread Seref Arikan
Thanks for the clarification Craig. On Mon, Oct 29, 2012 at 8:46 AM, Craig Ringer wrote: > On 10/29/2012 04:07 PM, Seref Arikan wrote: > > Greetings, > > I keep seeing statements like "Postgresql optimizer rewrites this query > > as" What I'm curious about is, is there a way to obtain SQL fo

Re: [GENERAL] Access to postgresql query optimizer output

2012-10-29 Thread Craig Ringer
On 10/29/2012 04:07 PM, Seref Arikan wrote: > Greetings, > I keep seeing statements like "Postgresql optimizer rewrites this query > as" What I'm curious about is, is there a way to obtain SQL form of > the re-written queries somewhere in the chain of query evaluation? It > does not make a lot

Re: [GENERAL] Why PGDLLIMPORT is needed

2012-10-29 Thread Craig Ringer
On 10/29/2012 02:05 PM, 高健 wrote: > On /src/include/storage/proc.h: > > I saw the following line: > > extern PGDLLIMPORT PGPROC *MyProc; > > I want to know why PGDLLIMPORT is used here? > > Does it mean: exten PGPROC *MyProc; right? What platform are you working on? On Windows it's required

[GENERAL] Access to postgresql query optimizer output

2012-10-29 Thread Seref Arikan
Greetings, I keep seeing statements like "Postgresql optimizer rewrites this query as" What I'm curious about is, is there a way to obtain SQL form of the re-written queries somewhere in the chain of query evaluation? It does not make a lot sense to generate sql again, but it would help a lot t

[GENERAL] Why BgWriterDelay is fixed?

2012-10-29 Thread 高健
In src/backend/postmaster/bgwriter.c , I can find the following source code(PostgreSQL9.2): /* * GUC parameters */ int BgWriterDelay = 200; ... rc = WaitLatch(&MyProc->procLatch, WL_LATCH_SET | WL_TIMEOUT | WL_POSTMASTER_DEATH, BgWriterDelay /* ms */ ); ... if (rc == WL_TIMEOUT && can_hi