public inbox for [email protected]
help / color / mirror / Atom feedChange to 'timing on' globally
14+ messages / 7 participants
[nested] [flat]
* Change to 'timing on' globally
@ 2010-07-05 17:00 Balkrishna Sharma <[email protected]>
2010-07-05 17:10 ` Re: Change to 'timing on' globally Alvaro Herrera <[email protected]>
0 siblings, 1 reply; 14+ messages in thread
From: Balkrishna Sharma @ 2010-07-05 17:00 UTC (permalink / raw)
To: [email protected]
I know that we can toggle the timing at session level by using \timing in psql.
Is there a way to set the default to 'timing on' globally across the database or atleast across all psql statements by a specificied user ?
Thanks,-Bala
_________________________________________________________________
The New Busy is not the too busy. Combine all your e-mail accounts with Hotmail.
http://www.windowslive.com/campaign/thenewbusy?tile=multiaccount&ocid=PID28326::T:WLMTAGL:ON:WL:...
^ permalink raw reply [nested|flat] 14+ messages in thread
* Re: Change to 'timing on' globally
2010-07-05 17:00 Change to 'timing on' globally Balkrishna Sharma <[email protected]>
@ 2010-07-05 17:10 ` Alvaro Herrera <[email protected]>
2010-07-05 19:40 ` Re: Change to 'timing on' globally Balkrishna Sharma <[email protected]>
0 siblings, 1 reply; 14+ messages in thread
From: Alvaro Herrera @ 2010-07-05 17:10 UTC (permalink / raw)
To: Balkrishna Sharma <[email protected]>; +Cc: pgsql-admin <[email protected]>
Excerpts from Balkrishna Sharma's message of lun jul 05 13:00:44 -0400 2010:
>
> I know that we can toggle the timing at session level by using \timing in psql.
> Is there a way to set the default to 'timing on' globally across the database or atleast across all psql statements by a specificied user ?
.psqlrc ?
^ permalink raw reply [nested|flat] 14+ messages in thread
* Re: Change to 'timing on' globally
2010-07-05 17:00 Change to 'timing on' globally Balkrishna Sharma <[email protected]>
2010-07-05 17:10 ` Re: Change to 'timing on' globally Alvaro Herrera <[email protected]>
@ 2010-07-05 19:40 ` Balkrishna Sharma <[email protected]>
2010-07-05 20:16 ` "Localizing" paths? Tim Landscheidt <[email protected]>
2010-07-06 12:38 ` [PATCH] Clarify that "psql -c" ignores psqlrc files Tim Landscheidt <[email protected]>
2010-07-06 14:48 ` Re: Change to 'timing on' globally Bruce Momjian <[email protected]>
0 siblings, 3 replies; 14+ messages in thread
From: Balkrishna Sharma @ 2010-07-05 19:40 UTC (permalink / raw)
To: [email protected]; +Cc: [email protected]
Thanks. If I want to do at system-wide level, where do I store the psqlrc file (assuming I want to change the timing behavior system-wide)?
(CentOS 5, Postgres 8.4)
$ ./pg_config --sysconfdir/opt/PostgreSQL/8.4/etc/postgresql
But I don't have /opt/PostgreSQL/8.4/etc/postgresql directory. Just creating the directory and putting a psqlrc file over there does not seem to work.
On a side-note, I observered that timing value in ~/.psqlrc was ignored by psql -c "..." command but not by echo "...."|psqlThought it was strange.
> CC: [email protected]
> Subject: Re: [ADMIN] Change to 'timing on' globally
> From: [email protected]
> To: [email protected]
> Date: Mon, 5 Jul 2010 13:10:30 -0400
>
> Excerpts from Balkrishna Sharma's message of lun jul 05 13:00:44 -0400 2010:
> >
> > I know that we can toggle the timing at session level by using \timing in psql.
> > Is there a way to set the default to 'timing on' globally across the database or atleast across all psql statements by a specificied user ?
>
> .psqlrc ?
>
> --
> Sent via pgsql-admin mailing list ([email protected])
> To make changes to your subscription:
> http://www.postgresql.org/mailpref/pgsql-admin
_________________________________________________________________
Hotmail has tools for the New Busy. Search, chat and e-mail from your inbox.
http://www.windowslive.com/campaign/thenewbusy?ocid=PID28326::T:WLMTAGL:ON:WL:en-US:WM_HMP:042010_1
^ permalink raw reply [nested|flat] 14+ messages in thread
* "Localizing" paths?
2010-07-05 17:00 Change to 'timing on' globally Balkrishna Sharma <[email protected]>
2010-07-05 17:10 ` Re: Change to 'timing on' globally Alvaro Herrera <[email protected]>
2010-07-05 19:40 ` Re: Change to 'timing on' globally Balkrishna Sharma <[email protected]>
@ 2010-07-05 20:16 ` Tim Landscheidt <[email protected]>
2010-07-06 00:08 ` Re: "Localizing" paths? Tom Lane <[email protected]>
2010-07-06 15:36 ` Re: "Localizing" paths? Peter Eisentraut <[email protected]>
2 siblings, 2 replies; 14+ messages in thread
From: Tim Landscheidt @ 2010-07-05 20:16 UTC (permalink / raw)
To: pgsql-docs
Balkrishna Sharma <[email protected]> wrote on -admin:
> Thanks. If I want to do at system-wide level, where do I store the psqlrc file (assuming I want to change the timing behavior system-wide)?
> (CentOS 5, Postgres 8.4)
> $ ./pg_config --sysconfdir/opt/PostgreSQL/8.4/etc/postgresql
> But I don't have /opt/PostgreSQL/8.4/etc/postgresql directory. Just creating the directory and putting a psqlrc file over there does not seem to work.
> [...]
This got me wondering: With the 8.4 RPMs, in psql's man
page, there is an unexplained
"*PREFIX*/share/psqlrc.sample"; the sample psqlrc installed
in /usr/share/pgsql/psqlrc.sample (sic!) says:
| -- Copy this to your sysconf directory (typically /usr/local/pgsql/etc) and
| -- rename it psqlrc.
Would it be feasible and desirable to "localize" the paths
in the configure stage? Pro: Fewer guesses by new users.
Con: Adds another level of complexity to the build system.
Tim
^ permalink raw reply [nested|flat] 14+ messages in thread
* Re: "Localizing" paths?
2010-07-05 17:00 Change to 'timing on' globally Balkrishna Sharma <[email protected]>
2010-07-05 17:10 ` Re: Change to 'timing on' globally Alvaro Herrera <[email protected]>
2010-07-05 19:40 ` Re: Change to 'timing on' globally Balkrishna Sharma <[email protected]>
2010-07-05 20:16 ` "Localizing" paths? Tim Landscheidt <[email protected]>
@ 2010-07-06 00:08 ` Tom Lane <[email protected]>
2010-07-06 12:53 ` Re: "Localizing" paths? Tim Landscheidt <[email protected]>
1 sibling, 1 reply; 14+ messages in thread
From: Tom Lane @ 2010-07-06 00:08 UTC (permalink / raw)
To: Tim Landscheidt <[email protected]>; +Cc: pgsql-docs
Tim Landscheidt <[email protected]> writes:
> Would it be feasible and desirable to "localize" the paths
> in the configure stage? Pro: Fewer guesses by new users.
> Con: Adds another level of complexity to the build system.
The bigger "con" is that anyone reading the docs on-line would be
given information that might be inappropriate for their platform.
regards, tom lane
^ permalink raw reply [nested|flat] 14+ messages in thread
* Re: "Localizing" paths?
2010-07-05 17:00 Change to 'timing on' globally Balkrishna Sharma <[email protected]>
2010-07-05 17:10 ` Re: Change to 'timing on' globally Alvaro Herrera <[email protected]>
2010-07-05 19:40 ` Re: Change to 'timing on' globally Balkrishna Sharma <[email protected]>
2010-07-05 20:16 ` "Localizing" paths? Tim Landscheidt <[email protected]>
2010-07-06 00:08 ` Re: "Localizing" paths? Tom Lane <[email protected]>
@ 2010-07-06 12:53 ` Tim Landscheidt <[email protected]>
2010-07-06 14:25 ` Re: "Localizing" paths? Tom Lane <[email protected]>
0 siblings, 1 reply; 14+ messages in thread
From: Tim Landscheidt @ 2010-07-06 12:53 UTC (permalink / raw)
To: pgsql-docs
Tom Lane <[email protected]> wrote:
>> Would it be feasible and desirable to "localize" the paths
>> in the configure stage? Pro: Fewer guesses by new users.
>> Con: Adds another level of complexity to the build system.
> The bigger "con" is that anyone reading the docs on-line would be
> given information that might be inappropriate for their platform.
Why? That would only be the case if the on-line docs were
copied verbatim from some developer's working directory (or
a buildfarm box). I don't know the current workflow, but it
shouldn't be a problem to "./configure --host=DOC-DUMMY &&
make www-install".
The biggest con I see is with the generation. If I under-
stood the discussion on the diagrams correctly, the tar
balls for the packagers have the documentation already done,
so the generation of the docs would either have to be pushed
to a later stage, or the users of packages wouldn't have any
benefit at all.
So, looking at the pro: Shelved it.
Tim
^ permalink raw reply [nested|flat] 14+ messages in thread
* Re: "Localizing" paths?
2010-07-05 17:00 Change to 'timing on' globally Balkrishna Sharma <[email protected]>
2010-07-05 17:10 ` Re: Change to 'timing on' globally Alvaro Herrera <[email protected]>
2010-07-05 19:40 ` Re: Change to 'timing on' globally Balkrishna Sharma <[email protected]>
2010-07-05 20:16 ` "Localizing" paths? Tim Landscheidt <[email protected]>
2010-07-06 00:08 ` Re: "Localizing" paths? Tom Lane <[email protected]>
2010-07-06 12:53 ` Re: "Localizing" paths? Tim Landscheidt <[email protected]>
@ 2010-07-06 14:25 ` Tom Lane <[email protected]>
2010-07-06 15:00 ` Re: "Localizing" paths? Tim Landscheidt <[email protected]>
0 siblings, 1 reply; 14+ messages in thread
From: Tom Lane @ 2010-07-06 14:25 UTC (permalink / raw)
To: Tim Landscheidt <[email protected]>; +Cc: pgsql-docs
Tim Landscheidt <[email protected]> writes:
> Tom Lane <[email protected]> wrote:
>> The bigger "con" is that anyone reading the docs on-line would be
>> given information that might be inappropriate for their platform.
> Why? That would only be the case if the on-line docs were
> copied verbatim from some developer's working directory (or
> a buildfarm box).
They have to be built *somewhere* ...
regards, tom lane
^ permalink raw reply [nested|flat] 14+ messages in thread
* Re: "Localizing" paths?
2010-07-05 17:00 Change to 'timing on' globally Balkrishna Sharma <[email protected]>
2010-07-05 17:10 ` Re: Change to 'timing on' globally Alvaro Herrera <[email protected]>
2010-07-05 19:40 ` Re: Change to 'timing on' globally Balkrishna Sharma <[email protected]>
2010-07-05 20:16 ` "Localizing" paths? Tim Landscheidt <[email protected]>
2010-07-06 00:08 ` Re: "Localizing" paths? Tom Lane <[email protected]>
2010-07-06 12:53 ` Re: "Localizing" paths? Tim Landscheidt <[email protected]>
2010-07-06 14:25 ` Re: "Localizing" paths? Tom Lane <[email protected]>
@ 2010-07-06 15:00 ` Tim Landscheidt <[email protected]>
0 siblings, 0 replies; 14+ messages in thread
From: Tim Landscheidt @ 2010-07-06 15:00 UTC (permalink / raw)
To: pgsql-docs
Tom Lane <[email protected]> wrote:
> Tim Landscheidt <[email protected]> writes:
>> Tom Lane <[email protected]> wrote:
>>> The bigger "con" is that anyone reading the docs on-line would be
>>> given information that might be inappropriate for their platform.
>> Why? That would only be the case if the on-line docs were
>> copied verbatim from some developer's working directory (or
>> a buildfarm box).
> They have to be built *somewhere* ...
That's why the paragraph read:
| Why? That would only be the case if the on-line docs were
| copied verbatim from some developer's working directory (or
| a buildfarm box). I don't know the current workflow, but it
| shouldn't be a problem to "./configure --host=DOC-DUMMY &&
| make www-install".
Tim
^ permalink raw reply [nested|flat] 14+ messages in thread
* Re: "Localizing" paths?
2010-07-05 17:00 Change to 'timing on' globally Balkrishna Sharma <[email protected]>
2010-07-05 17:10 ` Re: Change to 'timing on' globally Alvaro Herrera <[email protected]>
2010-07-05 19:40 ` Re: Change to 'timing on' globally Balkrishna Sharma <[email protected]>
2010-07-05 20:16 ` "Localizing" paths? Tim Landscheidt <[email protected]>
@ 2010-07-06 15:36 ` Peter Eisentraut <[email protected]>
1 sibling, 0 replies; 14+ messages in thread
From: Peter Eisentraut @ 2010-07-06 15:36 UTC (permalink / raw)
To: Tim Landscheidt <[email protected]>; +Cc: pgsql-docs
On mån, 2010-07-05 at 20:16 +0000, Tim Landscheidt wrote:
> Would it be feasible and desirable to "localize" the paths
> in the configure stage? Pro: Fewer guesses by new users.
> Con: Adds another level of complexity to the build system.
The documentation is shipped pre-built in the source tarball. So other
than with a sed, we can't really change it to match local situations.
^ permalink raw reply [nested|flat] 14+ messages in thread
* [PATCH] Clarify that "psql -c" ignores psqlrc files
2010-07-05 17:00 Change to 'timing on' globally Balkrishna Sharma <[email protected]>
2010-07-05 17:10 ` Re: Change to 'timing on' globally Alvaro Herrera <[email protected]>
2010-07-05 19:40 ` Re: Change to 'timing on' globally Balkrishna Sharma <[email protected]>
@ 2010-07-06 12:38 ` Tim Landscheidt <[email protected]>
2010-07-10 00:50 ` Re: [PATCH] Clarify that "psql -c" ignores psqlrc files Robert Haas <[email protected]>
2 siblings, 1 reply; 14+ messages in thread
From: Tim Landscheidt @ 2010-07-06 12:38 UTC (permalink / raw)
To: pgsql-docs
Balkrishna Sharma <[email protected]> wrote on -admin:
> Thanks. If I want to do at system-wide level, where do I store the psqlrc file (assuming I want to change the timing behavior system-wide)?
> (CentOS 5, Postgres 8.4)
> $ ./pg_config --sysconfdir/opt/PostgreSQL/8.4/etc/postgresql
> But I don't have /opt/PostgreSQL/8.4/etc/postgresql directory. Just creating the directory and putting a psqlrc file over there does not seem to work.
> On a side-note, I observered that timing value in ~/.psqlrc was ignored by psql -c "..." command but not by echo "...."|psqlThought it was strange.
> [...]
Patch attached to clarify the latter.
Tim
Attachments:
[text/x-patch] psql-clarify-c-option.patch (1.4K, 2-psql-clarify-c-option.patch)
download | inline diff:
diff --git a/doc/src/sgml/ref/psql-ref.sgml b/doc/src/sgml/ref/psql-ref.sgml
index df06517..4f3ef5c 100644
--- a/doc/src/sgml/ref/psql-ref.sgml
+++ b/doc/src/sgml/ref/psql-ref.sgml
@@ -79,7 +79,9 @@ PostgreSQL documentation
<para>
Specifies that <application>psql</application> is to execute one
command string, <replaceable class="parameter">command</replaceable>,
- and then exit. This is useful in shell scripts.
+ and then exit. This is useful in shell scripts. Start-up files
+ (<filename>psqlrc</filename> and <filename>~/.psqlrc</filename>) are
+ ignored with this option.
</para>
<para>
<replaceable class="parameter">command</replaceable> must be either
@@ -3090,10 +3092,12 @@ $endif
<itemizedlist>
<listitem>
<para>
- Before starting up, <application>psql</application> attempts to
+ Unless it is passed an <option>-X</option>
+ or <option>-c</option> option,
+ <application>psql</application> attempts to
read and execute commands from the system-wide
<filename>psqlrc</filename> file and the user's
- <filename>~/.psqlrc</filename> file.
+ <filename>~/.psqlrc</filename> file before starting up.
(On Windows, the user's startup file is named
<filename>%APPDATA%\postgresql\psqlrc.conf</filename>.)
See <filename><replaceable>PREFIX</>/share/psqlrc.sample</>
^ permalink raw reply [nested|flat] 14+ messages in thread
* Re: [PATCH] Clarify that "psql -c" ignores psqlrc files
2010-07-05 17:00 Change to 'timing on' globally Balkrishna Sharma <[email protected]>
2010-07-05 17:10 ` Re: Change to 'timing on' globally Alvaro Herrera <[email protected]>
2010-07-05 19:40 ` Re: Change to 'timing on' globally Balkrishna Sharma <[email protected]>
2010-07-06 12:38 ` [PATCH] Clarify that "psql -c" ignores psqlrc files Tim Landscheidt <[email protected]>
@ 2010-07-10 00:50 ` Robert Haas <[email protected]>
0 siblings, 0 replies; 14+ messages in thread
From: Robert Haas @ 2010-07-10 00:50 UTC (permalink / raw)
To: pgsql-docs
On Tue, Jul 6, 2010 at 8:38 AM, Tim Landscheidt <[email protected]> wrote:
> Balkrishna Sharma <[email protected]> wrote on -admin:
>
>> Thanks. If I want to do at system-wide level, where do I store the psqlrc file (assuming I want to change the timing behavior system-wide)?
>> (CentOS 5, Postgres 8.4)
>> $ ./pg_config --sysconfdir/opt/PostgreSQL/8.4/etc/postgresql
>> But I don't have /opt/PostgreSQL/8.4/etc/postgresql directory. Just creating the directory and putting a psqlrc file over there does not seem to work.
>
>> On a side-note, I observered that timing value in ~/.psqlrc was ignored by psql -c "..." command but not by echo "...."|psqlThought it was strange.
>> [...]
>
> Patch attached to clarify the latter.
Committed.
--
Robert Haas
EnterpriseDB: http://www.enterprisedb.com
The Enterprise Postgres Company
^ permalink raw reply [nested|flat] 14+ messages in thread
* Re: Change to 'timing on' globally
2010-07-05 17:00 Change to 'timing on' globally Balkrishna Sharma <[email protected]>
2010-07-05 17:10 ` Re: Change to 'timing on' globally Alvaro Herrera <[email protected]>
2010-07-05 19:40 ` Re: Change to 'timing on' globally Balkrishna Sharma <[email protected]>
@ 2010-07-06 14:48 ` Bruce Momjian <[email protected]>
2010-07-06 15:20 ` Re: Change to 'timing on' globally Balkrishna Sharma <[email protected]>
2 siblings, 1 reply; 14+ messages in thread
From: Bruce Momjian @ 2010-07-06 14:48 UTC (permalink / raw)
To: Balkrishna Sharma <[email protected]>; +Cc: [email protected]; [email protected]
Balkrishna Sharma wrote:
>
> Thanks. If I want to do at system-wide level, where do I store the
> psqlrc file (assuming I want to change the timing behavior system-wide)?
> (CentOS 5, Postgres 8.4)
> $ ./pg_config --sysconfdir/opt/PostgreSQL/8.4/etc/postgresql
> But I don't have /opt/PostgreSQL/8.4/etc/postgresql directory. Just
> creating the directory and putting a psqlrc file over there does not
> seem to work.
I just tested it here on Ubuntu and it worked:
$ sudo mkdir etc
$ sudo mkdir etc/postgresql
$ cd etc/postgresql/
$ sudo vi psqlrc
# add \echo test
$ pwd
/opt/PostgreSQL/8.4/etc/postgresql
$ ../../bin/psql -U postgres postgres
--> test
psql (8.4.2)
Type "help" for help.
postgres=#
> On a side-note, I observered that timing value in ~/.psqlrc was
> ignored by psql -c "..." command but not by echo "...."|psqlThought
> it was strange.
Yeah, that is odd.
--
Bruce Momjian <[email protected]> http://momjian.us
EnterpriseDB http://enterprisedb.com
+ None of us is going to be here forever. +
^ permalink raw reply [nested|flat] 14+ messages in thread
* Re: Change to 'timing on' globally
2010-07-05 17:00 Change to 'timing on' globally Balkrishna Sharma <[email protected]>
2010-07-05 17:10 ` Re: Change to 'timing on' globally Alvaro Herrera <[email protected]>
2010-07-05 19:40 ` Re: Change to 'timing on' globally Balkrishna Sharma <[email protected]>
2010-07-06 14:48 ` Re: Change to 'timing on' globally Bruce Momjian <[email protected]>
@ 2010-07-06 15:20 ` Balkrishna Sharma <[email protected]>
2010-07-06 15:29 ` Re: Change to 'timing on' globally Bruce Momjian <[email protected]>
0 siblings, 1 reply; 14+ messages in thread
From: Balkrishna Sharma @ 2010-07-06 15:20 UTC (permalink / raw)
To: [email protected]; +Cc: [email protected]; [email protected]
> I just tested it here on Ubuntu and it worked:I followed your steps and it worked in the way you indicated, on CentOS as well. But it still does not:a. work with psql -c "query" syntax. (Works in echo mode or in interactive mode.)b. it does not still seem to work if you fire the queries from a client box (in any mode - interactive or otherwise)ON SERVER I get:Timing is on. now------------------------------ 2010-07-06 11:06:13.16734-04(1 row)Time: 0.574 ms
ON CLIENT I just get: now------------------------------- 2010-07-06 11:06:28.455395-04(1 row)
~~~~~~~~~~~~~~~~~~~~Basically I am firing a lot of psql through unix script on several client machines and a lot of the psql are hanging for some other reasons. I also need to capture the timing of each query. So I need timing to be on.
Doing the following captures the timing but I don't know which psql statement is hanging when I do ps aux|grep psqlecho '\timing \\select * from ........' | psqlOn ps aux|grep psql I just see:> ps aux|grep psql2255 0.0 0.0 155636 1668 pts/1 S Jul05 0:00 psql3883 0.0 0.0 155636 1676 pts/1 S Jul05 0:00 psql4672 0.0 0.0 155636 1672 pts/1 S Jul05 0:00 psql4713 0.0 0.0 155636 1672 pts/1 S Jul05 0:00 psql4737 0.0 0.0 155636 1672 pts/1 S Jul05 0:00 psql4798 0.0 0.0 155636 1668 pts/1 S Jul05 0:00 psql5050 0.0 0.0 155636 1676 pts/1 S Jul05 0:00 psql5086 0.0 0.0 155636 1668 pts/1 S Jul05 0:00 psql5405 0.0 0.0 155636 1668 pts/1 S Jul05 0:00 psql7255 0.0 0.0 155644 1796 pts/1 S Jul05 0:00 psql
psql -c 'select * from "DAPP".student_common_data where student_id = 1000 and field_id =1988;' does make the ps aux more informative but it does not capture the query timing. From what I understand you cannot mix ('timing + query') in "-c" mode.
So trying to set 'timing on' outside the individual queries (and preferably outside the client machines) somewhere on the server so that psql -c on client would capture the timing automatically.
> From: [email protected]
> Subject: Re: [ADMIN] Change to 'timing on' globally
> To: [email protected]
> Date: Tue, 6 Jul 2010 10:48:48 -0400
> CC: [email protected]; [email protected]
>
> Balkrishna Sharma wrote:
> >
> > Thanks. If I want to do at system-wide level, where do I store the
> > psqlrc file (assuming I want to change the timing behavior system-wide)?
>
> > (CentOS 5, Postgres 8.4)
> > $ ./pg_config --sysconfdir/opt/PostgreSQL/8.4/etc/postgresql
>
> > But I don't have /opt/PostgreSQL/8.4/etc/postgresql directory. Just
> > creating the directory and putting a psqlrc file over there does not
> > seem to work.
>
> I just tested it here on Ubuntu and it worked:
>
> $ sudo mkdir etc
> $ sudo mkdir etc/postgresql
> $ cd etc/postgresql/
> $ sudo vi psqlrc
> # add \echo test
> $ pwd
> /opt/PostgreSQL/8.4/etc/postgresql
> $ ../../bin/psql -U postgres postgres
> --> test
> psql (8.4.2)
> Type "help" for help.
>
> postgres=#
>
> > On a side-note, I observered that timing value in ~/.psqlrc was
> > ignored by psql -c "..." command but not by echo "...."|psqlThought
> > it was strange.
>
> Yeah, that is odd.
>
> --
> Bruce Momjian <[email protected]> http://momjian.us
> EnterpriseDB http://enterprisedb.com
>
> + None of us is going to be here forever. +
_________________________________________________________________
Hotmail is redefining busy with tools for the New Busy. Get more from your inbox.
http://www.windowslive.com/campaign/thenewbusy?ocid=PID28326::T:WLMTAGL:ON:WL:en-US:WM_HMP:042010_2
^ permalink raw reply [nested|flat] 14+ messages in thread
* Re: Change to 'timing on' globally
2010-07-05 17:00 Change to 'timing on' globally Balkrishna Sharma <[email protected]>
2010-07-05 17:10 ` Re: Change to 'timing on' globally Alvaro Herrera <[email protected]>
2010-07-05 19:40 ` Re: Change to 'timing on' globally Balkrishna Sharma <[email protected]>
2010-07-06 14:48 ` Re: Change to 'timing on' globally Bruce Momjian <[email protected]>
2010-07-06 15:20 ` Re: Change to 'timing on' globally Balkrishna Sharma <[email protected]>
@ 2010-07-06 15:29 ` Bruce Momjian <[email protected]>
0 siblings, 0 replies; 14+ messages in thread
From: Bruce Momjian @ 2010-07-06 15:29 UTC (permalink / raw)
To: Balkrishna Sharma <[email protected]>; +Cc: [email protected]; [email protected]
Balkrishna Sharma wrote:
>
> > I just tested it here on Ubuntu and it worked:I followed your steps and it worked in the way you indicated, on CentOS as well. But it still does not:a. work with psql -c "query" syntax. (Works in echo mode or in interactive mode.)b. it does not still seem to work if you fire the queries from a client box (in any mode - interactive or otherwise)ON SERVER I get:Timing is on. now------------------------------ 2010-07-06 11:06:13.16734-04(1 row)Time: 0.574 ms
>
> ON CLIENT I just get: now------------------------------- 2010-07-06 11:06:28.455395-04(1 row)
>
> ~~~~~~~~~~~~~~~~~~~~Basically I am firing a lot of psql through unix script on several client machines and a lot of the psql are hanging for some other reasons. I also need to capture the timing of each query. So I need timing to be on.
> Doing the following captures the timing but I don't know which psql statement is hanging when I do ps aux|grep psqlecho '\timing \\select * from ........' | psqlOn ps aux|grep psql I just see:> ps aux|grep psql2255 0.0 0.0 155636 1668 pts/1 S Jul05 0:00 psql3883 0.0 0.0 155636 1676 pts/1 S Jul05 0:00 psql4672 0.0 0.0 155636 1672 pts/1 S Jul05 0:00 psql4713 0.0 0.0 155636 1672 pts/1 S Jul05 0:00 psql4737 0.0 0.0 155636 1672 pts/1 S Jul05 0:00 psql4798 0.0 0.0 155636 1668 pts/1 S Jul05 0:00 psql5050 0.0 0.0 155636 1676 pts/1 S Jul05 0:00 psql5086 0.0 0.0 155636 1668 pts/1 S Jul05 0:00 psql5405 0.0 0.0 155636 1668 pts/1 S Jul05 0:00 psql7255 0.0 0.0 155644 1796 pts/1 S Jul05 0:00 psql
>
> psql -c 'select * from "DAPP".student_common_data where student_id = 1000 and field_id =1988;' does make the ps aux more informative but it does not capture the query timing. From what I understand you cannot mix ('timing + query') in "-c" mode.
> So trying to set 'timing on' outside the individual queries (and preferably outside the client machines) somewhere on the server so that psql -c on client would capture the timing automatically.
I think you need to look at postgresql.conf variables like
log_min_duration_statement, and you are right that psqlrc is only going
to be read for clients on the server machine, and only via psql.
---------------------------------------------------------------------------
>
>
>
> > From: [email protected]
> > Subject: Re: [ADMIN] Change to 'timing on' globally
> > To: [email protected]
> > Date: Tue, 6 Jul 2010 10:48:48 -0400
> > CC: [email protected]; [email protected]
> >
> > Balkrishna Sharma wrote:
> > >
> > > Thanks. If I want to do at system-wide level, where do I store the
> > > psqlrc file (assuming I want to change the timing behavior system-wide)?
> >
> > > (CentOS 5, Postgres 8.4)
> > > $ ./pg_config --sysconfdir/opt/PostgreSQL/8.4/etc/postgresql
> >
> > > But I don't have /opt/PostgreSQL/8.4/etc/postgresql directory. Just
> > > creating the directory and putting a psqlrc file over there does not
> > > seem to work.
> >
> > I just tested it here on Ubuntu and it worked:
> >
> > $ sudo mkdir etc
> > $ sudo mkdir etc/postgresql
> > $ cd etc/postgresql/
> > $ sudo vi psqlrc
> > # add \echo test
> > $ pwd
> > /opt/PostgreSQL/8.4/etc/postgresql
> > $ ../../bin/psql -U postgres postgres
> > --> test
> > psql (8.4.2)
> > Type "help" for help.
> >
> > postgres=#
> >
> > > On a side-note, I observered that timing value in ~/.psqlrc was
> > > ignored by psql -c "..." command but not by echo "...."|psqlThought
> > > it was strange.
> >
> > Yeah, that is odd.
> >
> > --
> > Bruce Momjian <[email protected]> http://momjian.us
> > EnterpriseDB http://enterprisedb.com
> >
> > + None of us is going to be here forever. +
>
> _________________________________________________________________
> Hotmail is redefining busy with tools for the New Busy. Get more from your inbox.
> http://www.windowslive.com/campaign/thenewbusy?ocid=PID28326::T:WLMTAGL:ON:WL:en-US:WM_HMP:042010_2
--
Bruce Momjian <[email protected]> http://momjian.us
EnterpriseDB http://enterprisedb.com
+ None of us is going to be here forever. +
^ permalink raw reply [nested|flat] 14+ messages in thread
end of thread, other threads:[~2010-07-10 00:50 UTC | newest]
Thread overview: 14+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2010-07-05 17:00 Change to 'timing on' globally Balkrishna Sharma <[email protected]>
2010-07-05 17:10 ` Alvaro Herrera <[email protected]>
2010-07-05 19:40 ` Balkrishna Sharma <[email protected]>
2010-07-05 20:16 ` "Localizing" paths? Tim Landscheidt <[email protected]>
2010-07-06 00:08 ` Re: "Localizing" paths? Tom Lane <[email protected]>
2010-07-06 12:53 ` Re: "Localizing" paths? Tim Landscheidt <[email protected]>
2010-07-06 14:25 ` Re: "Localizing" paths? Tom Lane <[email protected]>
2010-07-06 15:00 ` Re: "Localizing" paths? Tim Landscheidt <[email protected]>
2010-07-06 15:36 ` Re: "Localizing" paths? Peter Eisentraut <[email protected]>
2010-07-06 12:38 ` [PATCH] Clarify that "psql -c" ignores psqlrc files Tim Landscheidt <[email protected]>
2010-07-10 00:50 ` Re: [PATCH] Clarify that "psql -c" ignores psqlrc files Robert Haas <[email protected]>
2010-07-06 14:48 ` Bruce Momjian <[email protected]>
2010-07-06 15:20 ` Balkrishna Sharma <[email protected]>
2010-07-06 15:29 ` Bruce Momjian <[email protected]>
This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox