Monitor what command is executing at the backend

Lists: pgsql-adminpgsql-sql
From: "Karthikeyan Sundaram" <skarthi98(at)hotmail(dot)com>
To: pgsql-admin(at)postgresql(dot)org, pgsql-sql(at)postgresql(dot)org
Subject: ERROR: invalid byte sequence for encoding "UTF8": 0x92
Date: 2007-03-20 19:34:09
Message-ID: BAY131-F9EB3EF541699B62FB5952B0750@phx.gbl
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-admin pgsql-sql

Hi,

I am using postgres 8.2.3. I have recently converted my database from
sql-ascii to UTF8. I have a portal which calls a perl program to insert the
data into the database.

While inserting, I am getting an error message

DBD::Pg::st execute failed: ERROR: invalid byte sequence for encoding
"UTF8": 0x92
[for Statement "INSERT INTO longdescs (bug_id, who, bug_when, thetext,
isprivate)

How can I set the client encoding in perl. Can somebody help me?

Regards
skarthi

_________________________________________________________________
Get a FREE Web site, company branded e-mail and more from Microsoft Office
Live! http://clk.atdmt.com/MRT/go/mcrssaub0050001411mrt/direct/01/


From: Ivo Rossacher <rossacher(at)bluewin(dot)ch>
To: pgsql-admin(at)postgresql(dot)org
Subject: Re: ERROR: invalid byte sequence for encoding "UTF8": 0x92
Date: 2007-03-20 20:03:12
Message-ID: 200703202103.12280.rossacher@bluewin.ch
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-admin pgsql-sql

Am Dienstag, 20. März 2007 20:34 schrieb Karthikeyan Sundaram:
> Hi,
>
> I am using postgres 8.2.3. I have recently converted my database from
> sql-ascii to UTF8. I have a portal which calls a perl program to insert
> the data into the database.
>
> While inserting, I am getting an error message
>
> DBD::Pg::st execute failed: ERROR: invalid byte sequence for encoding
> "UTF8": 0x92
> [for Statement "INSERT INTO longdescs (bug_id, who, bug_when, thetext,
> isprivate)
>
>
> How can I set the client encoding in perl. Can somebody help me?
>
> Regards
> skarthi

After the connection is done send set client_encoding to '<Encoding Perl is
using>' to the server. The server then will convert the strings back and
forward for you.
Se manual chapter 21.2 Character Set Support for more details.

Best regards
Ivo
>
> _________________________________________________________________
> Get a FREE Web site, company branded e-mail and more from Microsoft Office
> Live! http://clk.atdmt.com/MRT/go/mcrssaub0050001411mrt/direct/01/
>
>
> ---------------------------(end of broadcast)---------------------------
> TIP 7: You can help support the PostgreSQL project by donating at
>
> http://www.postgresql.org/about/donate


From: "Claus Guttesen" <kometen(at)gmail(dot)com>
To: "Karthikeyan Sundaram" <skarthi98(at)hotmail(dot)com>
Cc: pgsql-admin(at)postgresql(dot)org, pgsql-sql(at)postgresql(dot)org
Subject: Re: [SQL] ERROR: invalid byte sequence for encoding "UTF8": 0x92
Date: 2007-03-20 20:06:25
Message-ID: b41c75520703201306w2a1e08a5n41c86395f778d25b@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-admin pgsql-sql

> I am using postgres 8.2.3. I have recently converted my database from
> sql-ascii to UTF8. I have a portal which calls a perl program to insert the
> data into the database.
>
> While inserting, I am getting an error message
>
> DBD::Pg::st execute failed: ERROR: invalid byte sequence for encoding
> "UTF8": 0x92
> [for Statement "INSERT INTO longdescs (bug_id, who, bug_when, thetext,
> isprivate)

Try to modify client_encoding in postgresql.conf to utf8 and restart your db.

regards
Claus


From: Michael Fuhr <mike(at)fuhr(dot)org>
To: Claus Guttesen <kometen(at)gmail(dot)com>
Cc: Karthikeyan Sundaram <skarthi98(at)hotmail(dot)com>, pgsql-admin(at)postgresql(dot)org, pgsql-sql(at)postgresql(dot)org
Subject: Re: [SQL] ERROR: invalid byte sequence for encoding "UTF8": 0x92
Date: 2007-03-21 03:32:44
Message-ID: 20070321033244.GA39959@winnie.fuhr.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-admin pgsql-sql

On Tue, Mar 20, 2007 at 09:06:25PM +0100, Claus Guttesen wrote:
> >DBD::Pg::st execute failed: ERROR: invalid byte sequence for encoding
> >"UTF8": 0x92
> >[for Statement "INSERT INTO longdescs (bug_id, who, bug_when, thetext,
> >isprivate)
>
> Try to modify client_encoding in postgresql.conf to utf8 and restart your
> db.

The data is apparently not UTF-8 so client_encoding needs to be set
to something else. 0x92 is a hint that the encoding might be
Windows-1252 or Windows-1250 since that byte represents the right
single quotation mark in those encodings; that's a common character
in data that originated in Windows. Also, client_encoding can be set
by the client without having to restart the backend.

--
Michael Fuhr


From: "Karthikeyan Sundaram" <skarthi98(at)hotmail(dot)com>
To: pgsql-admin(at)postgresql(dot)org, pgsql-sql(at)postgresql(dot)org
Subject: growth of the database
Date: 2007-03-21 17:25:51
Message-ID: BAY131-F39F217C76C71862EB0528AB0740@phx.gbl
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-admin pgsql-sql

Hi,

Our database is growing fast. I want to create a cronjob that should
tell me what is the current size of the database on each day.

How can I find this from the database? Is there any pre-written scripts
written by somebody to share?

Regards
skarthi

_________________________________________________________________
Live Search Maps find all the local information you need, right when you
need it. http://maps.live.com/?icid=hmtag2&FORM=MGAC01


From: Guido Neitzer <lists(at)event-s(dot)net>
To: Karthikeyan Sundaram <skarthi98(at)hotmail(dot)com>
Cc: pgsql-admin(at)postgresql(dot)org, pgsql-sql(at)postgresql(dot)org
Subject: Re: growth of the database
Date: 2007-03-21 17:37:44
Message-ID: AA1DDA93-3883-4E39-BDA8-B41FC4134D68@event-s.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-admin pgsql-sql

On 21.03.2007, at 11:25, Karthikeyan Sundaram wrote:

> Our database is growing fast. I want to create a cronjob that
> should tell me what is the current size of the database on each day.
>
> How can I find this from the database? Is there any pre-written
> scripts written by somebody to share?

Be aware of linebreaks ...

[Galadriel: cug ] cug $ psql -U postgres -c "select pg_size_pretty
(pg_database_size('testdb'));"

pg_size_pretty
----------------
495 MB
(1 row)


From: "Karthikeyan Sundaram" <skarthi98(at)hotmail(dot)com>
To: pgsql-admin(at)postgresql(dot)org, pgsql-sql(at)postgresql(dot)org
Subject: Monitor what command is executing at the backend
Date: 2007-03-21 21:49:43
Message-ID: BAY131-F16DCAE8C81294422B3C522B0740@phx.gbl
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-admin pgsql-sql

Hi everybody,

Is there a way to see from the log files on what sql statement is
currently by which user? In other words, I want to monitor the DB activity.

How can I find it?

Regards
skarthi

_________________________________________________________________
Get a FREE Web site, company branded e-mail and more from Microsoft Office
Live! http://clk.atdmt.com/MRT/go/mcrssaub0050001411mrt/direct/01/


From: "George Pavlov" <gpavlov(at)mynewplace(dot)com>
To: "Karthikeyan Sundaram" <skarthi98(at)hotmail(dot)com>, <pgsql-admin(at)postgresql(dot)org>, <pgsql-sql(at)postgresql(dot)org>
Subject: Re: [SQL] Monitor what command is executing at the backend
Date: 2007-03-21 21:56:50
Message-ID: 8C5B026B51B6854CBE88121DBF097A869869D1@ehost010-33.exch010.intermedia.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-admin pgsql-sql

> Is there a way to see from the log files on what sql statement is
> currently by which user? In other words, I want to monitor
> the DB activity.

for a current snapshot you don't need the logs, try:

select * from pg_stat_activity;

(command string needs to be enabled for your database.)


From: "Karthikeyan Sundaram" <skarthi98(at)hotmail(dot)com>
To: gpavlov(at)mynewplace(dot)com, pgsql-admin(at)postgresql(dot)org, pgsql-sql(at)postgresql(dot)org
Subject: Re: [SQL] Monitor what command is executing at the backend
Date: 2007-03-21 22:16:42
Message-ID: BAY131-F184F459B61FD363B91BA2DB0740@phx.gbl
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-admin pgsql-sql

George,

How will I enable command string to see the commands?

Regards
skarthi

>From: "George Pavlov" <gpavlov(at)mynewplace(dot)com>
>To: "Karthikeyan Sundaram"
><skarthi98(at)hotmail(dot)com>,<pgsql-admin(at)postgresql(dot)org>,<pgsql-sql(at)postgresql(dot)org>
>Subject: Re: [SQL] Monitor what command is executing at the backend
>Date: Wed, 21 Mar 2007 14:56:50 -0700
>
> > Is there a way to see from the log files on what sql statement is
> > currently by which user? In other words, I want to monitor
> > the DB activity.
>
>for a current snapshot you don't need the logs, try:
>
> select * from pg_stat_activity;
>
>(command string needs to be enabled for your database.)
>
>---------------------------(end of broadcast)---------------------------
>TIP 7: You can help support the PostgreSQL project by donating at
>
> http://www.postgresql.org/about/donate

_________________________________________________________________
Its tax season, make sure to follow these few simple tips
http://articles.moneycentral.msn.com/Taxes/PreparationTips/PreparationTips.aspx?icid=HMMartagline


From: "George Pavlov" <gpavlov(at)mynewplace(dot)com>
To: "Karthikeyan Sundaram" <skarthi98(at)hotmail(dot)com>, <pgsql-admin(at)postgresql(dot)org>, <pgsql-sql(at)postgresql(dot)org>
Subject: Re: [SQL] Monitor what command is executing at the backend
Date: 2007-03-21 22:25:05
Message-ID: 8C5B026B51B6854CBE88121DBF097A869869E1@ehost010-33.exch010.intermedia.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-admin pgsql-sql

> How will I enable command string to see the commands?

in your postgresql.conf set stats_command_string = true

read
http://www.postgresql.org/docs/8.2/interactive/monitoring-stats.html for
details


From: Hubertus Freiherr von Fuerstenberg <hubertus(dot)fuerstenberg(at)ise(dot)fraunhofer(dot)de>
To: pgsql-sql(at)postgresql(dot)org
Subject: Re: growth of the database
Date: 2007-03-22 10:40:11
Message-ID: 46025D0B.8060805@ise.fraunhofer.de
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-admin pgsql-sql

Karthikeyan Sundaram wrote:
> Hi,
>
> Our database is growing fast. I want to create a cronjob that
> should tell me what is the current size of the database on each day.
>
> How can I find this from the database? Is there any pre-written
> scripts written by somebody to share?
>

Hi,
there is an administrative function called pg_database_size(name), as in
SELECT pg_database_size('mydb'); which returns the disk space used by
the database with the specified name.

See Chapter 9.20.

cheers,
Hubertus
--
Hubertus v. Fuerstenberg
MAIL: Fraunhofer Institute for Solar Energy Systems
Heidenhofstr. 2, 79110 Freiburg, Germany
PHONE: +49 (761) 4588 5153 FAX: +49 (761) 4588 9286
EMAIL: hubertus(dot)fuerstenberg(at)ise(dot)fraunhofer(dot)de
--- Quis custodiet ipsos custodes? ---