Thread: DTrace and PostgreSQL

DTrace and PostgreSQL

From
"Karen Hill"
Date:
I've got Solaris  10 11/06 on my PC.  I removed the static keyword in
src/backend/access/transam/xact.c. for the AbortTransaction and
CommitTransaction functions declarations and compiled 8.2.3.
Everything works nicely.

I was wondering if DTrace could tell me how many inserts are being
done in a pl/pgsql function while in a loop for example.  As you know
a pl/pgsql function executes in a single transaction so the DTrace
probe "transaction__commit(int)" I believe is not helpful here.  Could
DTrace measure how many inserts are being done in a transaction that
has not yet been commited, especially if that transaction block is in
a pl/pgsql function?  This would be extremely useful as when one has a
bunch of inserts one could be able to see how far along the pl/pgsql
function was.

regards,
karen


Re: DTrace and PostgreSQL

From
Alvaro Herrera
Date:
Karen Hill wrote:
> I've got Solaris  10 11/06 on my PC.  I removed the static keyword in
> src/backend/access/transam/xact.c. for the AbortTransaction and
> CommitTransaction functions declarations and compiled 8.2.3.
> Everything works nicely.
>
> I was wondering if DTrace could tell me how many inserts are being
> done in a pl/pgsql function while in a loop for example.  As you know
> a pl/pgsql function executes in a single transaction so the DTrace
> probe "transaction__commit(int)" I believe is not helpful here.  Could
> DTrace measure how many inserts are being done in a transaction that
> has not yet been commited, especially if that transaction block is in
> a pl/pgsql function?  This would be extremely useful as when one has a
> bunch of inserts one could be able to see how far along the pl/pgsql
> function was.

There are no trace points for that, but you can insert them if you want.
I believe the appropriate place to put it would be either heap_insert or
ExecInsert.

--
Alvaro Herrera                                http://www.CommandPrompt.com/
The PostgreSQL Company - Command Prompt, Inc.

Re: DTrace and PostgreSQL

From
"raysonlogin@gmail.com"
Date:
On Apr 12, 8:13 pm, "Karen Hill" <karen_hil...@yahoo.com> wrote:
> I was wondering if DTrace could tell me how many inserts are being
> done in a pl/pgsql function while in a loop for example.  As you know
> a pl/pgsql function executes in a single transaction so the DTrace
> probe "transaction__commit(int)" I believe is not helpful here.  Could
> DTrace measure how many inserts are being done in a transaction that
> has not yet been commited, especially if that transaction block is in
> a pl/pgsql function?  This would be extremely useful as when one has a
> bunch of inserts one could be able to see how far along the pl/pgsql
> function was.

Karen, having fun with communicating with your V125??

FYI:
http://pgfoundry.org/docman/view.php/1000163/230/PostgreSQL-DTrace-Users-Guide.pdf

Rayson



>
> regards,
> karen